我有一个数组(下面的示例),其中包含3个内容非常相似的数组.我想知道是否有一种简单的方法将所有内容放入一个数组,而不是三个单独的数组.我尝试的所有内容似乎都覆盖了数据,仅剩下第3个数组中的信息.
array
0 =>
array
'america' => int 19
'music' => int 6
'states' => int 5
'bank' => int 5
1 =>
array
'america' => int 19
'home' => int 3
'society' => int 2
'writers' => int 2
2 =>
array
'america' => int 19
'lutheran' => int 4
'church' => int 4
'national' => int 4
'cruises' => int 3
理想情况下,最终结果将如下所示:
array
'america' => int 19
'music' => int 6
'states' => int 5
'bank' => int 5
'america' => int 19
'home' => int 3
'society' => int 2
'writers' => int 2
'america' => int 19
'lutheran' => int 4
'church' => int 4
'national' => int 4
'cruises' => int 3
有什么办法吗?谢谢
解决方法:
您将无法使用具有相同键值(例如,“ America”的3个键,等等)的关联数组.当您尝试在数组中设置这些键时,您只会覆盖先前的值.