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--EXPECT-- 35*** Testing array_values() : usage variations *** 36 37-- Array values of a two-dimensional array -- 38array(3) { 39 [0]=> 40 string(4) "zero" 41 [1]=> 42 string(3) "one" 43 [2]=> 44 array(3) { 45 [0]=> 46 int(1) 47 [1]=> 48 int(2) 49 [2]=> 50 int(3) 51 } 52} 53 54-- Array values of a sub-array -- 55array(3) { 56 [0]=> 57 int(1) 58 [1]=> 59 int(2) 60 [2]=> 61 int(3) 62} 63 64-- Array values of an infinitely recursive array -- 65array(4) { 66 [0]=> 67 string(4) "zero" 68 [1]=> 69 string(3) "one" 70 [2]=> 71 array(3) { 72 [0]=> 73 int(1) 74 [1]=> 75 int(2) 76 [2]=> 77 int(3) 78 } 79 [3]=> 80 &array(4) { 81 ["zero"]=> 82 string(4) "zero" 83 ["un"]=> 84 string(3) "one" 85 ["sub"]=> 86 array(3) { 87 [0]=> 88 int(1) 89 [1]=> 90 int(2) 91 [2]=> 92 int(3) 93 } 94 [0]=> 95 *RECURSION* 96 } 97} 98Done 99