php similar_text() function
Translation results:
UK[ˈsɪmələ(r)] US[ˈsɪməlɚ]
adj. Similar; similar; same; similar
n. Analogue; similar person; similar thing
Plural: similars Comparative: more similar Superlative: most similar
php similar_text() functionsyntax
Function: Calculate the similarity of two strings and return the number of matching characters
Syntax: similar_text(string1,string2,percent)
Parameters:
Description | |
Required. Specifies the first string to compare. | |
Required. Specifies the second string to be compared. | |
Optional. Specifies the variable name used to store percent similarity. |
Note: The function can also calculate the percentage similarity of two strings.
php similar_text() functionexample
<?php echo similar_text("Hello World","Hello php.cn"); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
6
<?php echo similar_text("phpstudy","tomcat"); ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
1