array_count_values demo : array_count_values « Data Structure « PHP






array_count_values demo

 
<?php

$states = array("Ohio","Iowa","Arizona","Iowa","Ohio");
$stateFrequency = array_count_values($states);
print_r($stateFrequency);

?>
  
  








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() function counts the frequency of the values.