Hello...
This might be (I hope it is...) a very simple question!
What I have is two arrays each holding a set of ID numbers. What I want to do is if an ID number is in both arrays I want to remove that ID number from both arrays. So what I will end up with is an array that contains only the elements that were unique.
Hope that makes sense!
Thanks in advance! Kevin
Try with this method:
$a1=array("1","2","3"); $a2=array("4","2","5"); for($x=0;$x<count($a2);$x++) { if(!in_array($a2[$x],$a1)) $uniqueArray[]=$a2[$x]; } $uniqueArray=array_merge($a1,$uniqueArray);
EDIT:
hmm... reading the question again I misinterpreted it, so my solution is redundantly complex.
Nothing ..
I miss a button here to delete own posts :rolleyes: