note 51342 added to function.shm-attach
| From: | rch at todo dot com dot uy | Date: | Mon, 28 Mar 2005 12:17:47 +0000 |
| Subject: | note 51342 added to function.shm-attach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87086@lists.php.net to get a copy of this message | ||
Cecil, the key of a var is an integer (not the name ). You can put multiples vars in the same share.
#!/usr/local/bin/php -q
<?PHP
$SHM_KEY = ftok(__FILE__, chr( 4 ) );
$data = shm_attach($SHM_KEY, 1024, 0666);
$test1 = array("hello","world","1","2","3");
$test2 = array("hello","world","4","5","6");
$test3 = array("hello","world","7","8","9");
shm_put_var($data, 1, $test1);
shm_put_var($data, 2,$test2);
shm_put_var($data, 3,$test3);
print_r(shm_get_var($data, 1));
print_r(shm_get_var($data, 2));
print_r(shm_get_var($data, 3));
shm_detach($data);
?>
----
Manual Page -- http://www.php.net/manual/en/function.shm-attach.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51342
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51342&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51342&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51342&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51342&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51342&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51342&report=yes
Search -- http://master.php.net/manage/user-notes.php