Return to current_variation3.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test current() function : usage variations - referenced variables 3: --FILE-- 4: <?php 5: /* Prototype : mixed current(array $array_arg) 6: * Description: Return the element currently pointed to by the internal array pointer 7: * Source code: ext/standard/array.c 8: * Alias to functions: pos 9: */ 10: 11: /* 12: * Test how the internal pointer is affected when two variables are referenced to each other 13: */ 14: 15: echo "*** Testing current() : usage variations ***\n"; 16: 17: $array1 = array ('zero', 'one', 'two'); 18: 19: echo "\n-- Initial position of internal pointer --\n"; 20: var_dump(current($array1)); 21: next($array1); 22: 23: // Test that when two variables are referenced to one another 24: // the internal pointer is the same for both 25: $array2 = &$array1; 26: echo "\n-- Position after calling next() --\n"; 27: echo "\$array1: "; 28: var_dump(current($array1)); 29: echo "\$array2: "; 30: var_dump(current($array2)); 31: ?> 32: ===DONE=== 33: --EXPECTF-- 34: *** Testing current() : usage variations *** 35: 36: -- Initial position of internal pointer -- 37: string(4) "zero" 38: 39: -- Position after calling next() -- 40: $array1: string(3) "one" 41: $array2: string(3) "one" 42: ===DONE===