思路,循環其中一個數組,然后使用in_array() 函數,判斷被循環數組的每個元素是否在另外一個數組中即可
代碼如下:
$out_arr = array(); //交集或者是不重復的數組
if(!empty($res_repeat)){
//Wipe off the mac that in the mac_array
foreach($mac_array as $key=>$item){
if(!in_array(array("mac_addr"=>$item),$res_repeat)){
$out_arr[]=$item;
}
}
}else{
$out_arr = $mac_array;
}
只需要輸出$out_arr即可
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。