PHP 4, PHP 5, PHP 7, PHP 8
array_count_values - Counts all the values of an array

array_count_values( array$array ): array

array_count_values returns an array using the values of array as keys and their frequency in array as values.



The array of values to count

Return Values

Returns an associative array of values from array as keys and their count as value.

Exceptions and Errors

Throws E_WARNING for every element which is not string or int.

Related Functions

Example of array_count_values

Show all examples for array_count_values

PHP Version:

Function array_count_values:

Arrays Functions

Most used PHP functions