Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP soundex() Function

PHP soundex() Function

PHP String Reference Manual PHP String Reference Manual

Example

Calculate the soundex key of "Hello":

Run Example »


Definition and Usage

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

The soundex key is a 4-character alphanumeric string representing the English pronunciation of a word.

The soundex() function can be used in spell-checking programs.

**Note:** The soundex() function creates the same key for words with similar pronunciation.

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


Syntax

soundex(

string

)

Parameters Description
string Required. Specifies the string to check.

Technical Details

Return Value: Returns the soundex key of the string on success, or FALSE on failure.
PHP Version: 4+

More examples

Example 1

Use the soundex() function on two words with similar pronunciation:

"; echo soundex($str2); ?>

Run Example »


PHP String Reference Manual PHP String Reference Manual