HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
PHP String Reference : Calculate the metaphone key of "World"
The metaphone() function calculates the metaphone key of a string.
A metaphone key represents how a string sounds if said by an English speaking person.
The metaphone() function can be used for spelling applications.
Parameter | Description |
---|---|
string | Required. Specifies the string to check |
length | Optional. Specifies the maximum length of the metaphone key |
Return Value: | Returns the metaphone key of the string on success, or FALSE on failure. |
---|---|
PHP Version: | 4+ |
Using the metaphone() function on two similar sounding words:
<?php
$str = "Assistance";
$str2 = "Assistants";
echo metaphone($str);
echo "<br>";
echo metaphone($str2);
?>
Using the length parameter:
<?php
$str = "Assistance";
$str2 = "Assistants";
echo metaphone($str,5);
echo "<br>";
echo metaphone($str2,5);
?>
❮ PHP String Reference