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.
You can do it using foreach loop.
$arrayVal = array(1,2,3,1,2,3,1,2,3,4,4,5,6,4,5,6,88); $set_array = array(); foreach ($array as $value) { $set_array[$value]++; } print_r($set_array);
Output :-
Array( [1] => 3 [2] => 3 [3] => 3 [4] => 3 [5] => 2 [6] => 2 [88] => 1 )