PHP similar_text Function

What is similar_text Function and how it is used in string?


In PHP this function is used to calculate the similarity between two strings.



In the above syntax "string1" specifies the first string to compare,"string2" specifies the second string to compare, "percentage" specifies a variable to store the similarity in percentage.

Example :

echo similar_text("Hello World","Hello Peter");
Result :


In the above similar_text function example two strings are compared to display the percentage of similar characters.

PHP Topics

Ask Questions

Ask Question