Skip to content

Instantly share code, notes, and snippets.

@karlgroves
Created March 23, 2013 11:31
Show Gist options
  • Save karlgroves/5227391 to your computer and use it in GitHub Desktop.
Save karlgroves/5227391 to your computer and use it in GitHub Desktop.
PHP function to remove duplicate items from an array.
function cleanupduplicates($array){
$n = 0;
$crap = array_values(array_unique($array));
$cc = count($crap);
for ($i = 0; $i < $cc; $i++) {
if ($crap[$i] != ''){
$img[$n] = $crap[$i];
$n++;
}
}
return $img;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment