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