Merge multiple arrays from one array

前端 未结 7 1873
臣服心动
臣服心动 2020-12-11 06:03

How to merge multiple arrays from a single array variable ? lets say i have this in one array variable

Those are in one variable ..
$array

7条回答
  •  -上瘾入骨i
    2020-12-11 06:54

    array_merge can do the job

    $array_meged = array_merge($a, $b);
    

    after the comment

    If fixed indexs you can use:

    $array_meged = array_merge($a[0], $a[1]);
    

    A more generic solution:

    $array_meged=array();
      foreach($a as $child){
      $array_meged += $child;
    }
    

提交回复
热议问题