PHP array_count_values() Function
Complete PHP Array Reference Manual
Example
Count how many times each value occurs in an array:
Run Example »
Definition and Usage
The array_count_values() function counts how many times each value occurs in an array.
Syntax
array_count_values(
array
)
| Parameters | Description |
|---|---|
| array | Required. Specifies the array whose values are to be counted. |
Technical Details
| Return Value: | Returns an associative array whose keys are the values from the original array and whose values are the number of occurrences. |
|---|---|
| PHP Version: | 4+ |
Complete PHP Array Reference Manual