PHP Function comparisson: soundex() vs. metaphone()
In a previous tutorial I have discussed the PHP function soundex(), and how it produces a 4 digit code that can be used to compare words that sound alike, but are spelt differently (such as Weather and Whether).
And while soundex() is a very useful function, PHP offers a more exact alternative for the English language: metaphone(). The main difference being that metaphone() has mastered some of the basic rules of the English Language.
Note however that metaphone() should only be used on English words. It will not be of much use for instance with French, German, Italian or Spanish. Here is an example. Note that while soundex() returns the same code for Weather and Whether, metaphone() can indeed tell a slight difference:
The example illustrates two things. First that soundex() and metaphone() codes cannot be compared. Second that metaphone() is the more fine tuned of the two. Soundex() might still provide a better solution however regarding the suggestion of alternative keywords in search engines.