rgb192
asked on
php difference in strings
$string1='hello, how are you'
$string2='very different'
$string3='hi, how are you'
$string4='another string'
using php, is there a way to compare $string1 against $string2, $string3, $string4 and see that $string1 is similar to $string3
$string2='very different'
$string3='hi, how are you'
$string4='another string'
using php, is there a way to compare $string1 against $string2, $string3, $string4 and see that $string1 is similar to $string3
Firstly it is need to be cleared as to what he means by similar.
Is it similar sounding - soundex has to be used , or is string a lot like compared string - similarText would get a percent of similarity. Or does he simply means string1 is equal to
string3.
Is it similar sounding - soundex has to be used , or is string a lot like compared string - similarText would get a percent of similarity. Or does he simply means string1 is equal to
string3.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note the case-sensitive comparisons. You might want to normalize to upper case. Just a thought... ~Ray
ASKER
this code sample answered my question completely and taught me well
thanks
I have a similar question
gathering data from mysql instead of $string[]
https://www.experts-exchange.com/questions/27840917/mysql-instead-of-string.html
thanks
I have a similar question
gathering data from mysql instead of $string[]
https://www.experts-exchange.com/questions/27840917/mysql-instead-of-string.html
Others include soundex(): Returns the four-character soundex key of a word, which should be the same as the key for any similar-sounding word.
metaphone(): Similar to soundex, and possibly more effective for you. It's more accurate than soundex() as it knows the basic rules of English pronunciation. The metaphone generated keys are of variable length.