php - How to remove duplicate values compare two array -
i have 2 array.
one
array ( [0] => array ( [driverid] => 3 [latitude] => 23.752182 [longitude] => 90.377730 [distance] => 0 [esttime] => 0 ) [1] => array ( [driverid] => 6 [latitude] => 23.752782 [longitude] => 90.375730 [distance] => 0.2341134331552646 [esttime] => 133 ) )
two
array ( [0] => array ( [driverid] => 3 ) [1] => array ( [driverid] => 61 ) )
first array store in $info
, second array store in $infor
here first array item driverid 3 , second array item driverid 3.
so in output want skip first array first item.
when looping through each array store driverid in array , check current driverid not in array, if can skip it. example:
$ids = array(); foreach($infor $arr2){ $ids[] = $arr2['driverid']; } foreach($info $i){ if(!in_array($i['driverid'],$ids)){ print_r($i); } }
Comments
Post a Comment