shmop_write
Description
The shmop_write of Shmop for PHP writes data to the shared memory block.
Syntax
shmop_write( Shmop $shmop, string $data, int $offset ): int
Parameters
shmop
The shared memory block identifier created by shmop_open().
data
A string to write into shared memory block.
offset
Specifies where to start writing data inside the shared memory segment. The offset must be greater than or equal to zero and less than or equal to the actual size of the shared memory segment.
Return
Returns the size of the written data.
Examples
1 · shmop data offset
<? $filename = __FILE__; $project_id = "t"; $key = ftok($filename, $project_id); $mode = "c"; $permissions = 0o644; $size = 16; $shmop = shmop_open($key, $mode, $permissions, $size); $data = "mydata"; $offset = 10; $return = shmop_write($shmop, $data, $offset); echo $return; ?>
6