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
See also array_unique. If you concatenate the two arrays, it will then yank all duplicates.