Use the similar_text() function to compare similar words.
$word2compare = 'script';
$all_words = array(
'script',
'plazza',
'PHP',
'text',
'function'
);
$bestMatch = array('word' => $word2compare, 'match' => 0);
foreach($all_words as $word) {
similar_text($word, $word2compare, $percent);
if($percent > $bestMatch['match']) $bestMatch = array('word' => $word, 'match' => $percent);
}
if($bestMatch['match'] < 100) echo 'Did you mean: <strong>' . $bestMatch['word'] . '</strong>.';