本文介紹了PHP:合并 2 個多維數組的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我需要將 2 個多維數組合并在一起以創建一個新數組.
這 2 個數組是從 $_POST
和 $_FILES
創建的,我需要它們相互關聯.
I need to merge 2 multidimensional arrays together to create a new array.
The 2 arrays are created from $_POST
and $_FILES
and I need them to be associated with each other.
數組#1
數組#2
新數組
我正在使用的當前代碼有效,但僅適用于數組中的最后一項.
我假設通過循環 array_merge
函數,它會在每個循環中擦除我的新數組.
The current code i'm using works, but only for the last item in the array.
I'm presuming by looping the array_merge
function it wipes my new array every loop.
我該如何糾正?
推薦答案
[] 會將它附加到數組中而不是覆蓋.
the [] will append it to the array instead of overwriting.
這篇關于PHP:合并 2 個多維數組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!