1$arr = array(1, 4, 6, 1, 8, 9, 4, 6);
2
3$unique = array_unique($arr);
4
5$duplicates = array_diff_assoc($arr, $unique);
6
7print_r($duplicates);
8Array ( [3] => 1 [6] => 4 [7] => 6 )
1$counts = array_count_values($array);
2 $duplicate_title = array_filter($array, function ($value) use ($counts) {
3 return $counts[$value] > 1;
4 });
1function has_dupes($array) {
2 $dupe_array = array();
3 foreach ($array as $val) {
4 if (++$dupe_array[$val] > 1) {
5 return true;
6 }
7 }
8 return false;
9}