How else might you compare two arrays ($A and $B )and reduce matching elements out of the first to prep for the next loop over the array $A?
$A = array(1,2,3
You've got it. Just use array_diff or array_intersect. Doesn't get much easier than that.
array_diff
array_intersect
Edit: For example:
$arr_1 = array_diff($arr_1, $arr_2); $arr_2 = array_diff($arr_2, $arr_1);
Source