similar_text
similar_text
similar_text
- It Calculate the similarity between two strings
Syntax:
int similar_text ( string first, string second [, float percent])
It calculates the similarity between two strings. This recursive calls which may or may not speed up the whole process. Note also that the complexity of this algorithm is O(N**3) where N is the length of the longest string.
By passing a reference as third argument, similar_text() will calculate the similarity in percent for you. It returns the number of matching chars in both strings.
Example:
echo similar_text(”xyz”,”abcd”);
it returns 0. because here, no matching or similar letters found in these parameter.
echo similar_text(”test”,”text”);
it returns 3. because here, there are 3 letters are similar between these parameter.
