soundex – PHP String Functions

Syntax :

soundex ( string );

Description :

soundex() function calculates the soundex key of str. This soundex function returns a string 4 characters long, starting with a letter.

Note: It creates the same key for similar sounding words.

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


Parameter :

[table caption=”” width=”100%” colwidth=”15%|15%|15%|55%” colalign=”left|left|left|left”]
Name, Required /Optional, Value Type, Description
string1, Required, String, The input string.
[/table]


Output :

Returns the soundex key as a string.


Related articles :  htmlentities(), levenshtein() , metaphone() , similar_text().


soundex() – PHP Functions Example 1 :
<?php
$str = "Hi from tutorialmines!";
echo soundex($str);
?>

See below is the output of above code in web browser.

H165


You may also like...