PHP:合并 2 个多维数组
本文介绍了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 个多维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!