Last active
April 16, 2016 23:35
-
-
Save Raffaello/9907ab9d160911566344a894e4b3e793 to your computer and use it in GitHub Desktop.
typo suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function suggestion(array $words, $word) | |
{ | |
$lev = []; | |
foreach ($words as $w) { | |
$lev[$w] = levenshtein($word, $w); | |
} | |
return array_search(min($lev), $lev, true); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment