similar_text

int similar_text(string string_one, string string_two [variable $percent]) 
string_one First string to be compared
string_two Second string to be compared
$percent Variable to store the percentage similarity of the strings

Calculates the similarity of two strings.

Returns:

Number of characters that match between the two strings

Description:

similar_text() calculates the similarity of two strings. The function returns the number of unique characters that appear in both strings. The function can store the percentage similarity of the strings in the optional $percent parameter.

Version:

PHP 3.0.7, PHP 4+ since 4.0b2

See also:

Faster (but less accurate) method to analyze the similarity of two strings:

levenshtein() 

To generate ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.