Codice PHP:
$word = "warld"; //wrong word
$db = "Hello world, how are u? - asked the little pig to the big world";
$letters = "abcdefghijklmnopqrstuvxyz";
$i = 0;
$m = 0;
if(strpos($db, $word)
exit($word." exist in db");
while($i < 25):
while($m < count_chars($word)):
$try = substr_replace($word, $letters{$i}, $m, $m);
if(strpos($db, $try))
exit ("Did u mean ".$try."?");
endwhile;
endwhile;
Per ogni lettera del' alfabeto cambia una alla volta una lettera della tua parola e la confronta con $db.
Dovrebbe andare (spero)