oracle259 Posted September 28, 2006 Share Posted September 28, 2006 How can i combine the similar_text() and levenshtein() functions to get a more accurate match percentage than similar_text()I tried [code]$match = similar_text($word1, $word2, $percent);$percent = round($percent, 1); if ($percent > 5) {$lev = levenshtein($word1, $word2);$count1 = strlen($word1);$count2 = strlen($word2);$cnt = ($count1/$count2) * $lev;$cnt = round($cnt, 1);if ($cnt > 1) {echo "fail";} else {echo "pass";}} else {echo "pass";}[/code]but it fails to pass ass in asset because $percent = 0 and $cnt = 1.5Please help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.