i have string AABBBCCCDABBAACBB
, in this i need to find the most occurrence of Character , how can i find this??
in above string it should return 7 ad B comes 7 times i.e max.
$str = "AABBBCCCABB";
$strArray = count_chars($str,1);
foreach ($strArray as $key=>$value)
{
echo "The character <b>'".chr($key)."'</b> was found $value time(s)<br>";
//$highest=chr($key);
if(isset($highest) && $highest>chr($key))
{
$highest=chr($key);
}
}
echo "<br/><br/>Highest value is ::".$highest;
above code i tried,
i tried but functionality is not perfect , which function of php
i should use?