3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT rkenbgjengrnekjrgn2ioih34fnorfejk TEXT; $char = array_merge(range("a", "z"), range("A", "Z")); $length = strlen($text); $counter = array(); for($i = 0; $i < $length; $i++) { $item = $text[$i]; if (in_array($item, $char)) { $counter[$item] = isset($counter[$item]) ? $counter[$item] + 1 : 1; } } arsort($counter); var_dump($counter);

preferences:
48.17 ms | 405 KiB | 6 Q