-2
我有兩個數組:PHP - 一個陣列添加到另一個(遞歸?)
$array1 = array(
'currencies' => array(
'dollars' => array(80,120,75),
'euro' => array(25,35,10,85),
),
);
$array2 = array(
'currencies' => array(
'dollars' => array(25),
),
);
我想結果是:
$result = array(
'currencies' => array(
'dollars' => array(80,120,75,25),
'euro' => array(25,35,10,85),
),
);
這能在一個巧妙的方式實現的呢?我曾嘗試過array_merge,array_merge_recursively等。
我想這個問題可能會有所幫助:http://stackoverflow.com/questions/2140503/how-to-merge-subarray-in-php-most-easily –
你嘗試[array_merge_recursive()](https://secure.php.net/manual/ru/function.array-merge-recursive.php)?這不是你想要的嗎? – Andrew
你真的嘗試'array_merge_recursively()'? https://3v4l.org/AkeFu – IROEGBU