PHP similar_text Function

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

Explanation

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

Syntax:


similar_text(string1,string2,percent)

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 :


<?php
echo similar_text("Hello World","Hello Peter");
?>
Result :

7

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

PHP Topics


Ask Questions

Ask Question