Instance
Calculate the Metaphone key for "world":
<?phpecho Metaphone ("World");? >
Definition and usage
The Metaphone () function computes the Metaphone key for the string.
The Metaphone key represents the English pronunciation of the string.
The Metaphone () function is useful for spell checker.
Note: the Metaphone () function creates the same key for a word that sounds similar.
Note: The resulting metaphone key length is variable.
Tip: Metaphone () is more accurate than the SOUNDEX () function because Metaphone () understands the basic rules of English pronunciation.
Grammar
Metaphone (String,length)
Parameter description
string is required. Specifies the string to check.
Length is optional. Specifies the maximum length of the Metaphone key.
Technical details
Return value: Returns the Metaphone key of the string if successful, or FALSE if it fails.
PHP version: 4+
More examples
Example 1
Use the Metaphone () function for two words that are similar in pronunciation:
<?PHP$STR = "Assistance", $str 2 = "assistants", Echo Metaphone ($STR), echo "<br>", Echo Metaphone ($str 2);? >
Example 2
Use the length parameter:
<?PHP$STR = "Assistance", $str 2 = "assistants", Echo Metaphone ($str, 5), echo "<br>", Echo metaphone ($str 2,5);? >