Calculate the soundex key for "Hello":
<?php$str = "Hello";echo soundex($str);?>The soundex() function calculates the soundex key of a string.
The soundex key is a 4-character long alphanumeric string that represents the English pronunciation of a word.
The soundex() function can be used in spell checkers.
Note: The soundex() function creates identical keys for words that sound similar.
Tip: The metaphone() function is more precise than the soundex() function because metaphone() understands the basic rules of English pronunciation.
soundex( string )
parameter | describe |
---|---|
string | Required. Specifies the string to check. |
Return value: | Returns the soundex key of the string on success, or FALSE on failure. |
---|---|
PHP version: | 4+ |
Use the soundex() function on two words that sound similar:
<?php$str = "Assistance";$str2 = "Assistants";echo soundex($str);echo "<br>";echo soundex($str2);?>