shmop_read函数的强制偏移量

According to php.net site , the shmop_read function requires 3rd param as number of bytes to read.

In my example code i have hardcoded bytes to 64 each for writing in shm. However, the data in these bytes is not unknown to me. How can i read the data from shmop_read function if the number of bytes are unknown to me.

Goal is to read 64 bytes from the starting index in each function call.

The example code :

$my_string1 = 'This is a test string 1';
$my_string2 = 'This is a test string 2';
$my_string3 = 'This is a test string 3';
$shm_bytes_written1 = shmop_write($shm_id, $my_string1, 0);
$shm_bytes_written2 = shmop_write($shm_id, $my_string2, 65);
$shm_bytes_written3 = shmop_write($shm_id, $my_string3, 130);


//Read from shared memory block
$shm_data = shmop_read($shm_id, 0, 64);
if(!$shm_data){
    die('Could not read from a shared memory block');
}

echo 'Data retrieved from a shared memory block is '. $shm_data . "<br />";

$shm_data2 = shmop_read($shm_id, 65, 129);
if(!$shm_data2){
    die('Could not read from a shared memory block');
}

echo 'Data retrieved from a shared memory block is '. $shm_data2. "<br />";

$shm_data3 = shmop_read($shm_id, 130, $shm_bytes_written3);
if(!$shm_data3){
    die('Could not read from a shared memory block');
}


// Output generated
Data retrieved from a shared memory block is This is a test string 1T
Data retrieved from a shared memory block is This is a test string 2ThTThis is a test string 3
Data retrieved from a shared memory block is This is a test string 3

I fixed it Myself.

The mistake i was doing is insted of 64 character size in shmop_open function i was giving offset.