1--TEST-- 2Test array_merge() function : usage variations - multi-dimensional arrays 3--FILE-- 4<?php 5/* 6 * Test array_merge() with multi-dimensional arrays 7 */ 8 9echo "*** Testing array_merge() : usage variations ***\n"; 10 11$arr1 = array('zero', 'one', 'two', array(0)); 12$arr2 = array(1, 2, 3); 13 14echo "\n-- Merge a two-dimensional and a one-dimensional array --\n"; 15var_dump(array_merge($arr1, $arr2)); 16 17echo "\n-- Merge an array and a sub-array --\n"; 18var_dump(array_merge($arr1[3], $arr2)); 19var_dump(array_merge($arr2, $arr1[3])); 20 21echo "Done"; 22?> 23--EXPECT-- 24*** Testing array_merge() : usage variations *** 25 26-- Merge a two-dimensional and a one-dimensional array -- 27array(7) { 28 [0]=> 29 string(4) "zero" 30 [1]=> 31 string(3) "one" 32 [2]=> 33 string(3) "two" 34 [3]=> 35 array(1) { 36 [0]=> 37 int(0) 38 } 39 [4]=> 40 int(1) 41 [5]=> 42 int(2) 43 [6]=> 44 int(3) 45} 46 47-- Merge an array and a sub-array -- 48array(4) { 49 [0]=> 50 int(0) 51 [1]=> 52 int(1) 53 [2]=> 54 int(2) 55 [3]=> 56 int(3) 57} 58array(4) { 59 [0]=> 60 int(1) 61 [1]=> 62 int(2) 63 [2]=> 64 int(3) 65 [3]=> 66 int(0) 67} 68Done 69