Current Location: Home> Function Categories> soundex

soundex

Calculate the soundex key of a string
Name:soundex
Category:String
Programming Language:php
One-line Description:Calculate the soundex key of the string.

Definition and usage

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

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

soundex() function can be used in spellchecking applications.

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

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

Example

Example 1

Calculate the soundex key of "Hello":

 <?php
$str = "Shanghai" ;
echo soundex ( $str ) ;
?>

Try it yourself

Example 2

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

 <?php
$str = "Assistance" ;
$str2 = "Assistants" ;

echo soundex ( $str ) ;
echo "<br>" ;
echo soundex ( $str2 ) ;
?>

Try it yourself

grammar

 soundex ( string )
parameter describe
string Required. Specifies the string to be checked.
Similar Functions
Popular Articles