fork download
  1. <?php
  2.  
  3. $arr = array(1, 2,3,4,5,3);
  4.  
  5. $uarr = array_unique($arr);
  6.  
  7. print_r($uarr);
  8.  
  9. echo "\\n";
  10. echo "\n";
  11.  
  12. var_dump(array_diff($arr, array_diff($uarr, array_diff_assoc($arr, $uarr))));
  13.  
  14. echo "\n";
  15. echo "<\n";
  16. $unicos=(array_diff($arr, array_diff($uarr, array_diff_assoc($arr, $uarr))));
  17.  
  18. print_r($unicos);
Success #stdin #stdout 0.02s 23876KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
)
\n
array(2) {
  [2]=>
  int(3)
  [5]=>
  int(3)
}

<
Array
(
    [2] => 3
    [5] => 3
)