use the similar_text() function in the string manual.
I don't have time to rewrite this in full, but it suffices to show the basic concept.
foreach($result as $key=>$val) {
similar_text(strtolower($original_var));
strtolower($result[$key][$hintFlag]), &$per);
//$per now contains a percent of similarity
if ($per>59) { // if 60%=< then we are close enough
$whole_num = explode('.',$per);
$comp[$whole_num[0]] = $result[$key][$hintFlag];
}
}