我搜索了 SO 和 Google 并发现了与我类似的其他问题,但我无法将这些特定案例的答案翻译成我的案例。所以...我有两个数组,如下所示...数组 1 和数组 2。我想将它们组合起来,使它们最终像最终数组一样。
阵列 1
Array
(
[0] => Array
(
[id] => 12345
)
[1] => Array
(
[id] => 54321
)
)
阵列 2
Array
(
[0] => Array
(
[date_entered] => today
)
[1] => Array
(
[date entered] => yesterday
)
)
最终数组
Array
(
[0] => Array
(
[id] => 12345
[date_entered] => today
)
[1] => Array
(
[id] => 54321
[date entered] => yesterday
)
)
我尝试使用array_merge
as well,array_merge_recursive
但它并没有按照我的意愿合并它们:
Array
(
[0] => Array
(
[id] => 12345
)
[1] => Array
(
[id] => 54321
)
[2] => Array
(
[date_entered] => today
)
[3] => Array
(
[date entered] => yesterday
)
)
我究竟做错了什么?