PHP Classes

ipcContainer: Share variables between tasks with shared memory

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 152 All time: 9,062 This week: 455Up
Version License PHP version Categories
ipc-container 1.0Public Domain5.0PHP 5, Language


This class can share variables between tasks with shared memory.

It can attach to a given shared memory segment so it can store and retrieve values to be shared with other processes that access the memory segment with the same key.

Assigning variable values to the class variables will make it store the values in an associative array to be stored in the attached shared memory segment.

Likewise, retrieving variables of the class will retrieve values with the same index name from the array stored in the share memory segment.

Picture of Matthew Knowlton
  Performance   Level  
Name: Matthew Knowlton is available for providing paid consulting. Contact Matthew Knowlton .
Classes: 6 packages by
Country: United States United States
Age: 28
All time rank: 2036290 in United States United States
Week rank: 276 Up28 in United States United States Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x



//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/>";
'$container3 variable test set to '.print_r($container3->test,true).";<br/>";

  Files folder image Files  
File Role Description
Plain text file ipcContainer.class.php Class Class Source
Accessible without login Plain text file ipcContainer.example1.php Example Example Script
Accessible without login Plain text file ipcContainer.example2.php Example Example Script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,062
This week:455Up