How to use soundex in PHP
In this article I will explain how the soundex() function can be used in PHP.
soundex() function in PHP
- The soundex() function is used to calculate the soundex key of a string.
- The soundex() function creates the same key for similar sounding words.
- A soundex key is return a string four character long alphanumeric string starting with a letter that represent English pronunciation of a word.
- The soundex() function can be used for spelling applications.
- The soundex() function returns the soundex key of the string on success.
- The soundex() function returns FALSE on failure.
Syntax
Parameter
- string string is required parameter. it is check to be string.
Example
The following example show to how the soundex() function can be used in PHP.
<html>
<body>
<h3 style="color: blue;">soundex() function example in PHP</h3>
<?php
$str1 = "Than";
$str2 = "Then";
echo "soundex key of a string is : ".soundex($str1);
echo "<br />";
echo "soundex key of a string is : ".soundex($str2);
?>
</body>
</html>
|
Output
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here