Annotation of embedaddon/php/ext/standard/tests/array/array_shift_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_shift() function : basic functionality
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 basic functionality of array_shift()
12: */
13:
14: echo "*** Testing array_shift() : basic functionality ***\n";
15:
16: $array = array('zero', 'one', '3' => 'three', 'four' => 4);
17: echo "\n-- Before shift: --\n";
18: var_dump($array);
19:
20: echo "\n-- After shift: --\n";
21: echo "Returned value:\t";
22: var_dump(array_shift($array));
23: echo "New array:\n";
24: var_dump($array);
25:
26: echo "Done";
27: ?>
28: --EXPECTF--
29: *** Testing array_shift() : basic functionality ***
30:
31: -- Before shift: --
32: array(4) {
33: [0]=>
34: string(4) "zero"
35: [1]=>
36: string(3) "one"
37: [3]=>
38: string(5) "three"
39: ["four"]=>
40: int(4)
41: }
42:
43: -- After shift: --
44: Returned value: string(4) "zero"
45: New array:
46: array(3) {
47: [0]=>
48: string(3) "one"
49: [1]=>
50: string(5) "three"
51: ["four"]=>
52: int(4)
53: }
54: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>