I would like to count the occurrence of each duplicate item in an array and end up with an array of only unique/non duplicate items with their respective occurrences.
this code will return duplicate value in same array
$array = array(12,43,66,21,56,43,43,78,78,100,43,43,43,21); foreach($arr as $key=>$item){ if(array_count_values($arr)[$item] > 1){ echo "Found Matched value : ".$item." "; } }