X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP soundex() Function

PHP String Reference PHP String Reference

Example

Calculate the soundex key of "Hello":

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

Run example »

Definition and Usage

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

A soundex key is a four character long alphanumeric string that represent English pronunciation of a word.

The soundex() function can be used for spelling applications.

Note: The soundex() function creates the same key for similar sounding words.

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


Syntax

soundex(string)

Parameter 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

Using the soundex() function on two similar sounding words:

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

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

Run example »


PHP String Reference PHP String Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook