Latest web development tutorials

PHP soundex () function

PHP String Reference PHP String Reference

Examples

Calculation "Hello" the soundex key:

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

Running instance »

Definition and Usage

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

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

soundex () function can be used a spell checker.

Note: soundex () function is similar to the pronunciation of the word creates the same key.

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


grammar

soundex( string )

参数 描述
string 必需。规定要检查的字符串。

technical details

return value: If successful, it returns the soundex key of a string, if that fails it returns FALSE.
PHP version: 4+


More examples

Example 1

Two similar sounding words using soundex () function:

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

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

Running instance »


PHP String Reference PHP String Reference