1--TEST--
2Test array_values() function : usage variations - multi-dimensional arrays
3--FILE--
4<?php
5/*
6 * Test array_values when:
7 * 1. Passed a two-dimensional array as $input argument
8 * 2. Passed a sub-array as $input argument
9 * 3. Passed an infinitely recursive multi-dimensional array
10 */
11
12echo "*** Testing array_values() : usage variations ***\n";
13
14$input = array ('zero' => 'zero', 'un' => 'one', 'sub' => array (1, 2, 3));
15
16echo "\n-- Array values of a two-dimensional array --\n";
17var_dump(array_values($input));
18
19echo "\n-- Array values of a sub-array --\n";
20var_dump(array_values($input['sub']));
21
22// get an infinitely recursive array
23$input[] = &$input;
24echo "\n-- Array values of an infinitely recursive array --\n";
25var_dump(array_values($input));
26
27echo "Done";
28?>
29--EXPECT--
30*** Testing array_values() : usage variations ***
31
32-- Array values of a two-dimensional array --
33array(3) {
34  [0]=>
35  string(4) "zero"
36  [1]=>
37  string(3) "one"
38  [2]=>
39  array(3) {
40    [0]=>
41    int(1)
42    [1]=>
43    int(2)
44    [2]=>
45    int(3)
46  }
47}
48
49-- Array values of a sub-array --
50array(3) {
51  [0]=>
52  int(1)
53  [1]=>
54  int(2)
55  [2]=>
56  int(3)
57}
58
59-- Array values of an infinitely recursive array --
60array(4) {
61  [0]=>
62  string(4) "zero"
63  [1]=>
64  string(3) "one"
65  [2]=>
66  array(3) {
67    [0]=>
68    int(1)
69    [1]=>
70    int(2)
71    [2]=>
72    int(3)
73  }
74  [3]=>
75  &array(4) {
76    ["zero"]=>
77    string(4) "zero"
78    ["un"]=>
79    string(3) "one"
80    ["sub"]=>
81    array(3) {
82      [0]=>
83      int(1)
84      [1]=>
85      int(2)
86      [2]=>
87      int(3)
88    }
89    [0]=>
90    *RECURSION*
91  }
92}
93Done
94