是的,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
)
)