How to merge subarray in PHP most easily?

后端 未结 7 541
渐次进展
渐次进展 2020-12-03 22:32
$arr[] = array(\'A\',\'B\');
$arr[] = array(\'C\',\'B\');
...

I need to get the merged result of all sub array of $arr .

And f

7条回答
  •  庸人自扰
    2020-12-03 23:11

    If you really don't want to loop, try this:

    $arr[] = array('A','B');
    $arr[] = array('C','B');
    $arr[] = array('C','D');
    $arr[] = array('F','A');
    $merged = array_unique(call_user_func_array('array_merge', $arr));
    

提交回复
热议问题