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