3v4l.org

run code in 300+ PHP versions simultaneously
<?php function count_char($str) { $chars = str_split($str); $char_counter = array(); foreach($chars as $char) { if (ctype_alpha($char)) { if (!isset($char_counter[$char])) { $char_counter[$char] = 1; } else { ++$char_counter[$char]; } } } ksort($char_counter); return $char_counter; } var_dump(count_char("Hello World"));

preferences:
24.17 ms | 407 KiB | 5 Q