1
另一多陣列的特定元件I具有第一陣列看起來像這樣:合併數組在PHP
Array
(
[0] => Array
(
[data] => Array
(
[id] => 1
[type] => asset
[description] => Real Estate
[value] => 350000
)
)
)
第二陣列看起來像這樣:
Array
(
[0] => Array
(
[owners] => Array
(
[data] => Array
(
[id] => 1
[percentage] => 100
)
)
)
)
我需要插入第二數組第一個在「數據」的水平,所以它看起來是這樣的:
Array
(
[0] => Array
(
[data] => Array
(
[id] => 1
[type] => asset
[description] => Real Estate
[value] => 350000
[owners] => Array
(
[data] => Array
(
[id] => 1
[percentage] => 100
)
)
)
)
)
我試過array_merge,但出來放不正如我所料。首先將第二個數組的正常追加添加到第一個數組的範圍之外。
任何人都可以建議我將如何在上面顯示的級別添加第二個? THX
請出示相關的代碼,這將使它更容易確定是什麼問題。 – plamut
'$ array1 [0] ['data'] ['owners'] = $ array2 [0] ['owners']' – spinkus
$ array1 [0] ['data'] ['owners'] = $ array2 [0 ]['擁有者'] –