Easy Tutorial
❮ Func Math Bindec Func String Strip Tags ❯

PHP metaphone() Function

PHP String Reference Manual

Example

Calculate the metaphone key for "World":


Definition and Usage

The metaphone() function calculates the metaphone key of a string.

The metaphone key represents the English pronunciation of the string.

The metaphone() function can be used for spell checkers.

Note: The metaphone() function creates the same key for words that sound alike.

Note: The generated metaphone key can vary in length.

Tip: metaphone() is more accurate than the soundex() function because metaphone() understands basic English pronunciation rules.


Syntax

Parameter Description
string Required. Specifies the string to check.
length 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

Using the metaphone() function on two words that sound alike:

Example 2

Using the length parameter:


❮ Func Math Bindec Func String Strip Tags ❯