Return to 006.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test array_pop behaviour 3: --FILE-- 4: <?php 5: 6: array_pop($GLOBALS); 7: 8: $a = array("foo", "bar", "fubar"); 9: $b = array("3" => "foo", "4" => "bar", "5" => "fubar"); 10: $c = array("a" => "foo", "b" => "bar", "c" => "fubar"); 11: 12: /* simple array */ 13: echo array_pop($a), "\n"; 14: array_push($a, "foobar"); 15: var_dump($a); 16: 17: /* numerical assoc indices */ 18: echo array_pop($b), "\n"; 19: var_dump($b); 20: 21: /* assoc indices */ 22: echo array_pop($c), "\n"; 23: var_dump($c); 24: 25: ?> 26: --EXPECT-- 27: fubar 28: array(3) { 29: [0]=> 30: string(3) "foo" 31: [1]=> 32: string(3) "bar" 33: [2]=> 34: string(6) "foobar" 35: } 36: fubar 37: array(2) { 38: [3]=> 39: string(3) "foo" 40: [4]=> 41: string(3) "bar" 42: } 43: fubar 44: array(2) { 45: ["a"]=> 46: string(3) "foo" 47: ["b"]=> 48: string(3) "bar" 49: }