Skip to content

Instantly share code, notes, and snippets.

@joshghent
Created February 12, 2019 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshghent/c1dd7e4d8f19174a550d2da9112f0577 to your computer and use it in GitHub Desktop.
Save joshghent/c1dd7e4d8f19174a550d2da9112f0577 to your computer and use it in GitHub Desktop.
AgedFirsthandKeyboard created by joshghent - https://repl.it/@joshghent/AgedFirsthandKeyboard
$string = "floccinaucinihilipilification";
$characters = array_unique(str_split($string));
$count = [];
foreach($characters as $char) {
$count[$char] = substr_count($string, $char);
}
// Order the array
arsort($count);
echo json_encode($count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment