Hi, I'm looking for a library in PHP that will allow me to compare two strings, and determine if they similar. For example:
apple apple 100%
apple aple 80%
and so forth. any ideas?
Hi, I'm looking for a library in PHP that will allow me to compare two strings, and determine if they similar. For example:
apple apple 100%
apple aple 80%
and so forth. any ideas?
http://www.php.net/manual/en/function.similar-text.php
Does exactly that.
You might consider using the levenshtein, similar-text, soundex, or metaphone functions.
Also, if you're doing this comparison as a part of a data extraction from a database, many DB engines have a SOUNDS LIKE (or SOUNDEX) implementation. Doing this in the DB server would be faster than doing it in PHP.