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
How do I remove trailing whitespace?How do I find the length of a string in PHP?
How do I turn a string into an array?
How do I replace a word in a string in PHP?
How can I remove spaces from around a string value?
