array_count_values () Definition and usage
The Array_count_values () function is used to count the occurrences of all values in an array.
This function returns an array whose key name is the value of the original array, and the key value is the number of occurrences of the value in the original array.
Grammar
Array_count_values (Array) parameter description
Array required. Specifies the input array.
Example
Copy CodeThe code is as follows:
$a =array ("Cat", "Dog", "Horse", "dog");
Print_r (Array_count_values ($a));
?>
Output:
Array ([Cat] = 1 [Dog] = 2 [Horse] + 1)
http://www.bkjia.com/PHPjc/324495.html www.bkjia.com true http://www.bkjia.com/PHPjc/324495.html techarticle Array_count_values () defines and uses the Array_count_values () function to count the occurrences of all values in the array. This function returns an array whose key name is the value of the original array, the key ...