PHP array_count_values() Function
The array_count_values() function counts all the values of an array.
If you want to get duplicate values count in an array,this method can be use easily.It will display array values all count.
$array = array("A","B","C","A","C");
print_r(array_count_values($array));
Output
Array ( [A] => 2 [B] => 1 [C] => 2 )
Leave a Reply