我试图想出一种方法,将两个具有不同键名和相同值的数组结合起来?匹配值的顺序可能不同,因此需要检查它是否匹配,如果是则合并。有没有简单的方法可以完成?任何帮助或指导表示赞赏。
阵列 1
Array
(
[0] => Array
(
[location_id] => 1
[location_title] => Centralia
[location_slug] => Centralia
[state_name] => Illinois
)
[1] => Array
(
[location_id] => 3
[location_title] => Columbia
[location_slug] => columbia
[state_name] => Illinois
)
[2] => Array
(
[location_id] => 15
[location_title] => Dixon Hennepin
[location_slug] => dixon-hennepin
[state_name] => Illinois
)
)
阵列 2
Array
(
[0] => Array
(
[hours_locationid] => 3
)
[1] => Array
(
[hours_locationid] => 1
)
[2] => Array
(
[hours_locationid] => 15
)
)
结果
Array
(
[0] => Array
(
[location_id] => 1
[location_title] => Centralia
[location_slug] => Centralia
[state_name] => Illinois
[hours_locationid] => 1
)
[1] => Array
(
[location_id] => 3
[location_title] => Columbia
[location_slug] => columbia
[state_name] => Illinois
[hours_locationid] => 3
)
[2] => Array
(
[location_id] => 15
[location_title] => Dixon Hennepin
[location_slug] => dixon-hennepin
[state_name] => Illinois
[hours_locationid] => 15
)
)