How do I calculate the metaphone of a string?
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'.
Comment on this Question and Answer >>>
ASK A QUESTION
More strings PHP Questions
What is the difference between ' and "?How can I remove spaces from around a string value?
How do I remove space from the start of a PHP string?
How do I one-way encrypt a string in PHP?
How do I print the " in an echo statement?
