Skip to content

Instantly share code, notes, and snippets.

@agborkowski
Created July 5, 2012 09:40
Show Gist options
  • Save agborkowski/3052653 to your computer and use it in GitHub Desktop.
Save agborkowski/3052653 to your computer and use it in GitHub Desktop.
duplicate
<?php
//@link http://codepad.viper-7.com/GOutvO
$data = array(1,2,3,1,3,99,99,4,5,3,2,1,99);
$duplicate = array();
foreach ($data as $a) {
array_pop($data);
foreach($data as $b){
if ($a == $b && !in_array($a,$duplicate)){
$duplicate[] = $b;
echo "duplicate {$a} <br />\r\n";
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment