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