The metaphone() function calculates the metaphone key of a string.
A metaphone key represents how a string sounds if said by an English speaking person.
The metaphone() function can be used for spelling applications.
Note: The metaphone() function creates the same key for similar sounding words.
Note: The generated metaphone keys vary in length.
Tip: metaphone() is more accurate than the soundex() function, because metaphone() knows the basic rules of English pronunciation.
| Parameter | Description |
|---|---|
| string | Required. Specifies the string to check |
| length | Optional. Specifies the maximum length of the metaphone key |
| Return Value: | Returns the metaphone key of the string on success, or FALSE on failure. |
|---|---|
| PHP Version: | 4+ |
Using the metaphone() function on two similar sounding words:
Using the length parameter:
Complete PHP String Reference
Your message has been sent to W3Schools.