It is an inbuilt function in PHP. It is one of the most simple functions that is used to count all the values inside an array. In other words we can say that it is used to calculate the frequency of all of the elements of an array.

BY Best Interview Question ON 07 Apr 2020

Example

$array = array("B","Cat","Dog","B","Dog","Dog","Cat");
print_r(array_count_values($array));

// OUTPUT : Array ( [B] => 2 [Cat] => 2 [Dog] => 3 )