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 count the number of words in my text?How do I reverse a string in PHP?
How do I break email address into username and hostname?
What is the usage of {} in strings?
How do I join strings together?
