Phpmetaphone () function analysis-small_123 php metaphone () function compute string metaphone key. This article introduces the basic usage and example of php metaphone () function to coders, you can refer to the methods and examples in this article for the necessary coders.
Definition and usage
Metaphone () function calculates the metaphone key of a string.
Metaphone indicates the English pronunciation of a string.
The metaphone () function can be used by spelling check programs.
Note: The metaphone () function creates the same key for words with similar pronunciation.
Note: the length of the generated metaphone key is variable.
Tip: metaphone () is more accurate than soundex (), because metaphone () understands basic English pronunciation rules.
Syntax
metaphone(string,length)
Parameters |
Description |
String |
Required. Specifies the string to be checked. |
Length |
Optional. Specifies the maximum length of the metaphone key. |
Technical details
Return value: |
If the call succeeds, the metaphone key of the string is returned. if the call fails, FALSE is returned. |
PHP version: |
4 + |
Instance
Example 1
Use the metaphone () function for two words with similar pronunciation:
";echo metaphone($str2);?>
Online operation
Example 2
Use the length parameter:
";echo metaphone($str2,5);?>
Online operation
Address: http://www.manongjc.com/article/816.html