array_count_values() function of PHP is used to count all the items of an array means it count the number of occurrence of a value into an array. It is an inbuilt function of PHP.
It returns an associative array which contains array values as keys and their occurrences as values.Syntax
$array represents an array.
<?php $arr=array("Mango","Orange","Pear","Mango","Banana","Apple"); $new_arr=array_count_values($arr); echo "<pre>"; print_r($new_arr); ?>
You May Also Like
Subscribe To Never Miss an Article From