PHP - How to merge arrays inside array

前端 未结 4 1662
灰色年华
灰色年华 2020-11-27 04:24

How to merge n number of array in php. I mean how can I do the job like :
array_merge(from : $result[0], to : $result[count($result)-1])
OR<

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 04:31

    Try this

    $result = array_merge($array1, $array2);
    

    Or, instead of array_merge, you can use the + op which performs a union:

    $array2 + array_fill_keys($array1, '');
    

提交回复
热议问题