1--TEST-- 2Test array_merge_recursive() function : basic functionality - array with default keys 3--FILE-- 4<?php 5/* Prototype : array array_merge_recursive(array $arr1[, array $...]) 6 * Description: Recursively merges elements from passed arrays into one array 7 * Source code: ext/standard/array.c 8*/ 9 10echo "*** Testing array_merge_recursive() : array with default keys ***\n"; 11 12// Initialise the arrays 13$arr1 = array(1, array(1, 2)); 14$arr2 = array(3, array("hello", 'world')); 15$arr3 = array(array(6, 7), array("str1", 'str2')); 16 17// Calling array_merge_recursive() with default arguments 18echo "-- With default argument --\n"; 19var_dump( array_merge_recursive($arr1) ); 20 21// Calling array_merge_recursive() with more arguments 22echo "-- With more arguments --\n"; 23var_dump( array_merge_recursive($arr1,$arr2) ); 24var_dump( array_merge_recursive($arr1,$arr2,$arr3) ); 25 26echo "Done"; 27?> 28--EXPECTF-- 29*** Testing array_merge_recursive() : array with default keys *** 30-- With default argument -- 31array(2) { 32 [0]=> 33 int(1) 34 [1]=> 35 array(2) { 36 [0]=> 37 int(1) 38 [1]=> 39 int(2) 40 } 41} 42-- With more arguments -- 43array(4) { 44 [0]=> 45 int(1) 46 [1]=> 47 array(2) { 48 [0]=> 49 int(1) 50 [1]=> 51 int(2) 52 } 53 [2]=> 54 int(3) 55 [3]=> 56 array(2) { 57 [0]=> 58 string(5) "hello" 59 [1]=> 60 string(5) "world" 61 } 62} 63array(6) { 64 [0]=> 65 int(1) 66 [1]=> 67 array(2) { 68 [0]=> 69 int(1) 70 [1]=> 71 int(2) 72 } 73 [2]=> 74 int(3) 75 [3]=> 76 array(2) { 77 [0]=> 78 string(5) "hello" 79 [1]=> 80 string(5) "world" 81 } 82 [4]=> 83 array(2) { 84 [0]=> 85 int(6) 86 [1]=> 87 int(7) 88 } 89 [5]=> 90 array(2) { 91 [0]=> 92 string(4) "str1" 93 [1]=> 94 string(4) "str2" 95 } 96} 97Done 98