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)
If you don't care about the ordering of the keys, you could do the following:
$array = YOUR_ARRAY $unique = array(); foreach ($array as $a) { $unique[$a] = $a; }