I would like to check if my array has any duplicates and return the duplicated values in an array. I want this to be as efficient as possible.
Example:
this will be ~100 times faster than array_diff
$dups = array(); foreach(array_count_values($arr) as $val => $c) if($c > 1) $dups[] = $val;