array_count_values() function counts the frequency of the values.
Its syntax is: array array_count_values (array array);
<?
$states = array("OH", "OK", "CA", "PA", "OH", "OH", "PA", "AK");
$state_freq = array_count_values($states);
print_r( $state_freq );
?>
Related examples in the same category