PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I calculate the metaphone of a string?


If you want to do this then you will need to use the metaphone function within PHP.

If you don't know what this is or why you might want to know, then the chances are that you don't!

Basically this is useful when you are looking for words that are similar sounding, and so has applications in things like spell checkers and so on.

<?php
$text 
"stitch";
$text2 "rich";

$meta1 =  metaphone($text);

$meta2 =  metaphone($text2);

echo 
"Metaphone returns: $meta1 and $meta2";
//Metaphone returns: STTX and RX
?>


Similar sounding words will have the same key, e.g. 'sun' and 'son'.



More strings PHP Questions

How can I repeat a string variable several times?
How do I extract the values of variables from a string?
What is the difference between ' and "?
How do I convert relevant characters in a string to HTML entities?
How do I find the position of a letter in a string in PHP?