You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
295 B

4 years ago
  1. <?php
  2. $units = array();
  3. for($i=0;$i<1000000;$i++){
  4. $units[] = uniqid();
  5. echo $units[$i].PHP_EOL;
  6. }
  7. $values = array_count_values($units);
  8. $duplicates = [];
  9. foreach($values as $k=>$v){
  10. if($v>1){
  11. $duplicates[$k]=$v;
  12. }
  13. }
  14. echo '<pre>';
  15. print_r($duplicates);
  16. echo '</pre>';
  17. ?>