php多维数组去重

<?php
$arr1[0]= ['id'=>1,'name'=>'test'];
$arr1[1]=['id'=>2,'name'=>'test'];

$arr3[0]= ['id'=>1,'name'=>'test'];
$arr3[1]=['id'=>2,'name'=>'test2'];

$arr2 = [0=>['id'=>1,'name'=>'test'],
         1=>['id'=>2,'name'=>'test2']
        ];
$b = array_merge($arr1,$arr3);//合并数组
$b = array_unique($b, SORT_REGULAR);
var_dump($b);
?>

 

posted @ 2018-12-27 12:00  双木君  Views(3013)  Comments(0Edit  收藏  举报