Please read the comments in the code. I need to pop the elements that match certain criteria
$popthisarray= array(12, 34);
main array
array
0
array
'id' => int 12
1
array
'id' => int 1456
2
array
'id' => int 34
3
array
'id' => int 534
I need to pop the elements from the main array that are in $popthisarray
I have
foreach($mainarray as $myarray){
// $myid will be either 12 0r 34
if(in_array($my['id'],$mainarray)){
//here I need to take the element out of main array
}
}
You would like to remove all elements of the
$mainarray, that haveidvalue in the$popthisarray?If you wish to reorganise keys, use
array_values: