Reputation: 11
I have two 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
and second array store in $infor
here first array item driverId is 3 and second array item driverId is 3.
so in my output i want to skip first array first item.
Upvotes: 0
Views: 46
Reputation: 1126
When looping through each array store the driverId in another array and also check that the current driverId is not in this array, if it is then we can skip it. For example:
$ids = array();
foreach($infor AS $arr2){
$ids[] = $arr2['driverId'];
}
foreach($info AS $i){
if(!in_array($i['driverId'],$ids)){
print_r($i);
}
}
Upvotes: 1