Shouldn't you do the strpos check first and call levenshtein only in case strpos didnt succeeded?