How do I add elements to an array only if they aren\'t in there already? I have the following:
$a=array(); // organize the array foreach($array as $k=>$v)
Try this code, I got it from here
$input = Array(1,2,3,1,2,3,4,5,6); $input = array_map("unserialize", array_unique(array_map("serialize", $input)));