[Solved] PHP words array count

[ad_1]

Take a look at array_count_values and arsort.

<?php  
$myarray = array("Human","Angel","God","Angel","Devil","God","God","Human","God","Angel");

$result = array_count_values($myarray);
arsort($result);

foreach($result as $word => $count)
{
    echo $word." was found ".$count." time(s)<br/>";
}
?>

[ad_2]

solved PHP words array count