Definition
The array_count_values() function counts all the values of an array.
Syntax
array_count_values(array)
Parameters
Parameter | Description |
---|---|
array |
Required. Specifying the array to count values of |
Example
<?php
$cities = array("New York", "Berlin", "Tokyo", "Berlin", "Berlin", "Tokyo");
print_r(array_count_values($cities));