Similarity Percentage between strings using php

by Mohan 2014-06-26 15:26:36

Percentage of similarity between strings using php

Want to know the similarity percentage between two strings?. Php provides a in built function called similar_text();
Example code:
<?php
$string1="HELLO";
$string2="WELCOME";
similar_text($string1, $string1, $percentage);
echo $percentage;
?>
 
will display 50 as result.
If the strings are equal then the percentage is 100.
740
like
0
dislike
0
mail
flag

You must LOGIN to add comments