Shared Memory - Essais01

Shared Memory - Essais01

'; $SHM_KEY = getShmKey(); $data = shm_attach( $SHM_KEY, 1024, 0600); // plusieurs variables dans un même segment de mémoire. $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); echo ''; } function action_reader() { echo 'READER:'; echo '
';
  $SHM_KEY = getShmKey();
  $data =  shm_attach( $SHM_KEY, 1024, 0666);
  print_r(shm_get_var($data, 1));
  print_r(shm_get_var($data, 2));
  print_r(shm_get_var($data, 3));
 shm_detach($data);
  echo '
'; } function action_remove() { echo 'REMOVE:'; echo '
';
  $SHM_KEY = getShmKey();
  $data =  shm_attach( $SHM_KEY, 1024, 0666);
  shm_remove($data);
  shm_detach($data);
  echo '
'; } ?>