Find the match percentage between two strings in php?

user1518659 picture user1518659 · Aug 28, 2012 · Viewed 7.4k times · Source

can anyone suggest me a better method(or most preferred method) to find the match percentage between two strings(i.e. how closely those two strings(eg. name) are related in terms of percentage) using fuzzy logic.? can anyone help me to write the code? really i am wondering where to start..

Answer

Nick Aversano picture Nick Aversano · Sep 16, 2013
$str1 = 'Hello';
$str2 = 'Hello, World!';
$percent;
similar_text($str1, $str2, $percentage);

http://php.net/manual/en/function.similar-text.php