The array_count_values () function of the php array function sequence counts the number of occurrences of all values in the array. Array_count_values () defines and uses the array_count_values () function to count the number of occurrences of all values in the array. This function returns an array. The key name of the element is the value of the original array.
Array_count_values () definition and usage
The array_count_values () function is used to count the number of occurrences of all values in the array.
This function returns an array. The key name of the element is the value of the original array, and the key value is the number of times this value appears in the original array.
Syntax
Array_count_values (array) parameter description
Array is required. Specifies the input array.
Example
The code is as follows:
$ A = array ("Cat", "Dog", "Horse", "Dog ");
Print_r (array_count_values ($ ));
?>
Output:
Array ([Cat] => 1 [Dog] => 2 [Horse] => 1)
The http://www.bkjia.com/PHPjc/324495.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324495.htmlTechArticlearray_count_values () definition and usage array_count_values () function is used to count the number of occurrences of all values in the array. This function returns an array. The key name of the element is the value of the original array...