ID:               26177
 Comment by:       cunha17 at uol dot com dot br
 Reported By:      l_faillie at yahoo dot com
 Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: Solaris 8
 PHP Version:      4.3.3
 New Comment:

In fact, you should use an array if you want to store multiple
information.

Source 1 : storing variables

$shm = shm_attach( 2710, 512);  
$data = array('val'=>'blabla', 
              'jour'=> date('D'));
shm_put_var( $shm, 'data', serialize($data));


Source 2 : reading variables

$shm = shm_attach( 2710, 512);
$data = unserialize(shm_get_var($shm, 'data'));
echo 'val :', $data['val'], "\n";
echo 'jour :', $data['jour'], "\n";


Previous Comments:
------------------------------------------------------------------------

[2003-11-08 10:06:05] l_faillie at yahoo dot com

Description:
------------
Hi all,

It seems only one variable can be stored in a SHM zone.

Reproduce code:
---------------
Source 1 : storing variables

$shm = shm_attach( 2710, 512);  

shm_put_var( $shm, 'val', 'blabla');
shm_put_var( $shm, 'jour', date('D'));

Source 2 : reading variables

$shm = shm_attach( 2710, 512);
echo 'val :', shm_get_var($shm, 'val'), "\n";
echo 'jour :', shm_get_var($shm, 'jour'), "\n";

Expected result:
----------------
val :blabla
jour :Sat

Actual result:
--------------
val :Sat
jour :Sat



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26177&edit=1

Reply via email to