1--TEST-- 2shm_get_var() tests 3--SKIPIF-- 4<?php if (!extension_loaded("sysvshm")) print "skip"; ?> 5--FILE-- 6<?php 7 8$key = ftok(__FILE__, 't'); 9$s = shm_attach($key, 1024); 10 11shm_put_var($s, -1, "test string"); 12shm_put_var($s, 0, new stdclass); 13shm_put_var($s, 1, array(1,2,3)); 14shm_put_var($s, 2, false); 15shm_put_var($s, 3, null); 16 17var_dump(shm_get_var()); 18 19var_dump(shm_get_var(-1, -1)); 20 21var_dump(shm_get_var($s, 1000)); 22var_dump(shm_get_var($s, -10000)); 23 24var_dump(shm_get_var($s, array())); 25var_dump(shm_get_var($s, -1)); 26var_dump(shm_get_var($s, 0)); 27var_dump(shm_get_var($s, 1)); 28var_dump(shm_get_var($s, 2)); 29var_dump(shm_get_var($s, 3)); 30 31shm_put_var($s, 3, "test"); 32shm_put_var($s, 3, 1); 33shm_put_var($s, 3, null); 34 35var_dump(shm_get_var($s, 3)); 36shm_remove($s); 37 38echo "Done\n"; 39?> 40--EXPECTF-- 41 42Warning: shm_get_var() expects exactly 2 parameters, 0 given in %s005.php on line %d 43NULL 44 45Warning: shm_get_var() expects parameter 1 to be resource, integer given in %s005.php on line %d 46NULL 47 48Warning: shm_get_var(): variable key 1000 doesn't exist in %s005.php on line %d 49bool(false) 50 51Warning: shm_get_var(): variable key -10000 doesn't exist in %s005.php on line %d 52bool(false) 53 54Warning: shm_get_var() expects parameter 2 to be long, array given in %s005.php on line %d 55NULL 56string(11) "test string" 57object(stdClass)#%d (0) { 58} 59array(3) { 60 [0]=> 61 int(1) 62 [1]=> 63 int(2) 64 [2]=> 65 int(3) 66} 67bool(false) 68NULL 69NULL 70Done 71