PHP比较两个二维数组,去除重复元素
$doorplates_from_database = db('doorplate')->where('street_id', $street_id)->field('name,street_id')->select(); //dump($doorplates_from_database); //$group指的是重复的门牌号 $group = array(); foreach ($doorplates as $key => $value) { foreach ($doorplates_from_database as $k => $v) { if ($value['name'] == $v['name']) { $group[] = $v['name']; unset($doorplates[$key]); } } } //dump($doorplates); //dump($group); $res = db('doorplate')->insertAll($doorplates);