Monday, 29 September 2014

metaphone in PHP

PHP metaphone() function is utlilized to a calculated metaphone key of a specified string.

A metaphone key stands for how a string sounds if stated by an English talking individual.

The metaphone() function could be utilized for spelling provisions.

Syntax:

metaphone(string,length)
string : Required. Defines the input string.

length : Optional. Defines the maximum length.

Note : The produced metaphone keys change in length. 

Note : The PHP metaphone() function makes the same key for smiler sounding statements.

Tip : PHP metaphone() function is more faultless than the soundex() function, because PHP metaphone() function knows the essential manages of English pronunciation.

Example:

<?php
echo metaphone("welcome");
echo "<br />";
echo metaphone("good bye");
?>
Output will be:
WLKM
KTBY

0 comments:

Post a Comment