如果我有这样的数组:
Array
(
[0] => Array
(
[user_id] => 1
[item_id] => 2
[quant] => 3
)
[1] => Array
(
[user_id] => 5
[item_id] => 5
[quant] => 6
)
)
如何继续向其中添加元素以获得此结果:
Array
(
[0] => Array
(
[user_id] => 1
[item_id] => 2
[quant] => 3
)
[1] => Array
(
[user_id] => 5
[item_id] => 5
[quant] => 6
)
[2] => Array
(
[user_id] => 7
[item_id] => 8
[quant] => 9
)
)
我尝试了一些函数,如 array_merge 和 array_push,但没有成功。问题是在向其中添加更多数组时单独处理每个嵌套数组。