array_count_values() function counts the frequency of the values. : array_count_values « Data Structure « PHP






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

1.Counts all the values of an array with array array_count_values (array input)
2.array_count_values demo