将2d数组转换为1d PHP

我有一个数组(下面的示例),其中包含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个键,等等)的关联数组.当您尝试在数组中设置这些键时,您只会覆盖先前的值.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...