There is a function similar_text() in PHP, that can be used to find the similarity of two strings, this function accepts three parameters: 1) string1, 2) string2 and 3) percent, percent will have the percentage of the similar text.
<?php
$str1 = "Welcome @ IncludeHelp";
$str2 = "Welcome @ IncludeHelp";
$str3 = "Welcome atIncludeHelp";
//Here, $percent will store the percentage of the similarity
similar_text($str1, $str2, $percent);
echo "similarity b/w str1 and str2 is: $percent \n";
similar_text($str2, $str3, $percent);
echo "similarity b/w str2 and str3 is: $percent \n";
?>
Output
similarity b/w str1 and str2 is: 100
similarity b/w str2 and str3 is: 90.47619047619
There is a function similar_text() in PHP, that can be used to find the similarity of two strings, this function accepts three parameters: 1) string1, 2) string2 and 3) percent, percent will have the percentage of the similar text.
Output
need an explanation for this answer? contact us directly to get an explanation for this answer