<?php
require_once('ipcContainer.class.php');
//open two shared memory slots
$container1 = new ipcContainer('1234');
$container2 = new ipcContainer('4321');
//opening a pointer to the same ipcContainer as container2
//for testing purposes
$container3 = new ipcContainer('4321');
//write variable "test" differently into each slot
$container1->test = array('hello' => 'world');
$container2->test = 'hello world';
//this data is immediately available on any other process or any other container with the same id
//and can be immediately overwritten by another container with the same id
$container3->test = 'Goodbye planet!!!';
//show the stored data
//container1 will print the ['hello' => 'world']
echo '$container1 variable test set to '.print_r($container1->test,true).";<br/>";
//container2 will print 'Goodbye planet!!!'
//because it is accessing the same ipcContainer as container3
echo '$container2 variable test set to '.print_r($container2->test,true).";<br/>";
echo '$container3 variable test set to '.print_r($container3->test,true).";<br/>";
?>
|