【发布时间】:2018-09-02 03:20:34
【问题描述】:
我有 2 个数组,我必须在同一索引内合并数组。
Array
(
[0] => Array
(
[vendor_name] => MIRAGE PET PRODUCTS
[count_es] => 86
[outofstalk] => 19
[listing] => 64
[pricing] => 2
[discontinued] => 1
[others] => 0
)
[1] => Array
(
[vendor_name] => THE HOME DEPOT
[count_es] => 1
[outofstalk] => 0
[listing] => 1
[pricing] => 0
[discontinued] => 0
[others] => 0
)
)
这是第一个数组和
Array
( [0] => Array
(
[incorrect_esc_count] => 1
)
[1] => Array
(
[incorrect_esc_count] => 0
)
)
这是第二个数组。
我想要那个结果
Array
(
[0] => Array
(
[vendor_name] => MIRAGE PET PRODUCTS
[count_es] => 86
[outofstalk] => 19
[listing] => 64
[pricing] => 2
[discontinued] => 1
[others] => 0
[incorrect_esc_count] => 1
)
[1] => Array
(
[vendor_name] => THE HOME DEPOT
[count_es] => 1
[outofstalk] => 0
[listing] => 1
[pricing] => 0
[discontinued] => 0
[others] => 0
[incorrect_esc_count] => 0
)
)
我怎样才能做到这一点? `第一个数组从一个变量中获取,第二个数组从另一个变量中获取。我希望这个应该放在一个数组中,因为对于视图我使用 angular.js 并使用表
【问题讨论】:
-
请格式化您的问题。
-
你有相关代码要发吗?另外,您使用的是什么语言? php?最后,我觉得应该是“缺货”。
-
@ecg8 ,我正在使用 PHP 和 2 个不同的变量,因为它的 2 个查询并希望显示在同一个表中
标签: php merge associative-array