Syntax
array array_count_values ( array $input ); |
Definition and Usage
Returns an array using the values of the input array as keys and their frequency in input as values.
Paramters
Parameter | Description |
---|---|
input | The array of values to count |
Return Values
Returns an assosiative array of values from input as keys and their count as value.
Example
Try out following example:
<?php $input_array = array("orange", "mango", "banan", "orange" ); print_r(array_count_values($input_array)); ?> |
This will produce following result:
Array ( [orange] => 2 [mango] => 1 [banana => 1 ) |
No comments:
Post a Comment