Monday, 29 September 2014

soundex in PHP

PHP soundex() function is utilized to compute and return soundex key of a string.

It stands for an English pronunciation of a word and it is of four character long alphanumeric string.

PHP soundex() function might be utilized for spelling requisitions. 

Syntax:

soundex(string)
string : Required. Defines the input string

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

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

Example:

<?php
echo soundex("welcome");
echo "<br />";
echo soundex("good bye");
?>
Output will be:
W425
G310

0 comments:

Post a Comment