阅读量:9
是的,array_merge函数支持多维数组。当使用array_merge函数合并多维数组时,它会将多个数组合并成一个新数组,保持原始数组的结构。例如:
$array1 = array("a" => array("red"), "b" => array("green", "blue")); $array2 = array("a" => array("yellow"), "b" => array("purple")); $result = array_merge($array1, $array2); print_r($result);
输出结果为:
Array ( [a] => Array ( [0] => red [1] => yellow ) [b] => Array ( [0] => green [1] => blue [2] => purple ) )