Annotation of embedaddon/php/ext/standard/tests/array/array_shift_variation7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_shift() function : usage variations - position of internal pointer
3: --FILE--
4: <?php
5: /* Prototype : mixed array_shift(array &$stack)
6: * Description: Pops an element off the beginning of the array
7: * Source code: ext/standard/array.c
8: */
9:
10: /*
11: * Test that the internal pointer is reset after calling array_shift()
12: */
13:
14: echo "*** Testing array_shift() : usage variations ***\n";
15:
16: $stack = array ('one' => 'un', 'two' => 'deux');
17:
18: echo "\n-- Call array_shift() --\n";
19: var_dump($result = array_shift($stack));
20:
21: echo "\n-- Position of Internal Pointer in Passed Array: --\n";
22: echo key($stack) . " => " . current ($stack) . "\n";
23:
24: echo "Done";
25: ?>
26: --EXPECTF--
27: *** Testing array_shift() : usage variations ***
28:
29: -- Call array_shift() --
30: string(2) "un"
31:
32: -- Position of Internal Pointer in Passed Array: --
33: two => deux
34: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>