1--TEST--
2Test array_shift() function : usage variations - multi-dimensional arrays
3--FILE--
4<?php
5/*
6 * Test popping elements from a sub-array and popping an array from an array
7 */
8
9echo "*** Testing array_shift() : usage variations ***\n";
10
11$stack_first = array(array(1, 2, 3), 'one', 'two');
12$stack_last = array ('zero', 'one', array (1, 2, 3));
13echo "\n-- Before shift: --\n";
14echo "---- \$stack_first:\n";
15var_dump($stack_first);
16echo "---- \$stack_last:\n";
17var_dump($stack_last);
18
19echo "\n-- After shift: --\n";
20echo "---- Pop array from array:\n";
21echo "Returned value:\t";
22var_dump(array_shift($stack_first));
23echo "New array:\n";
24var_dump($stack_first);
25
26echo "---- Pop element from array within array:\n";
27echo "Returned value:\t";
28var_dump(array_shift($stack_last[2]));
29echo "New array:\n";
30var_dump($stack_last);
31
32echo "Done";
33?>
34--EXPECT--
35*** Testing array_shift() : usage variations ***
36
37-- Before shift: --
38---- $stack_first:
39array(3) {
40  [0]=>
41  array(3) {
42    [0]=>
43    int(1)
44    [1]=>
45    int(2)
46    [2]=>
47    int(3)
48  }
49  [1]=>
50  string(3) "one"
51  [2]=>
52  string(3) "two"
53}
54---- $stack_last:
55array(3) {
56  [0]=>
57  string(4) "zero"
58  [1]=>
59  string(3) "one"
60  [2]=>
61  array(3) {
62    [0]=>
63    int(1)
64    [1]=>
65    int(2)
66    [2]=>
67    int(3)
68  }
69}
70
71-- After shift: --
72---- Pop array from array:
73Returned value:	array(3) {
74  [0]=>
75  int(1)
76  [1]=>
77  int(2)
78  [2]=>
79  int(3)
80}
81New array:
82array(2) {
83  [0]=>
84  string(3) "one"
85  [1]=>
86  string(3) "two"
87}
88---- Pop element from array within array:
89Returned value:	int(1)
90New array:
91array(3) {
92  [0]=>
93  string(4) "zero"
94  [1]=>
95  string(3) "one"
96  [2]=>
97  array(2) {
98    [0]=>
99    int(2)
100    [1]=>
101    int(3)
102  }
103}
104Done
105