
metaphone() function calculates the metaphone key of string. A metaphone key represents how a string sounds if said by an English speaking person.
It can be used for spelling applications.
Similar to soundex() metaphone creates the same key for similar sounding words. metaphone() function is more accurate than soundex() as it knows the basic rules of English pronunciation. The metaphone generated keys are of variable length.
Metaphone was developed by Lawrence Philips <lphilips at verity dot com>. It is described in [“Practical Algorithms for Programmers”, Binstock & Rex, Addison Wesley, 1995].
[table caption=”” width=”100%” colwidth=”15%|15%|15%|55%” colalign=”left|lef|lef|left”]
Name, Required /Optional, Value Type, Description
string , Required, String , It is the input string for which we have to calculate metaphone key.
key_length, Optional, Integer, Specifies the maximum length of the metaphone key.
[/table]
Returns the metaphone key as a string, or FALSE on failure.
<?php
var_dump(metaphone('tutorialmines'));
var_dump(metaphone('tutorial'));
?> See below is the output of above code in web browser.
string(7) “TTRLMNS”
string(4) “TTRL”
<?php
var_dump(metaphone('tutorialmines',5));
var_dump(metaphone('tutorial',3));
?> See below is the output of above code in Web browser.
When it comes to children, there’s one universal truth: the right toy can spark imagination, build skills, and make memories…
In today’s digital age, where screens and gadgets dominate our children’s lives, there’s something heartwarming about a well-loved plush toy…
In a world dominated by screens and fast-paced routines, it’s easy to forget the simple magic of a toy in…
In the heart of Delhi’s vibrant streets lies a world where imagination meets innovation — the magical universe of toys.…
When was the last time a toy truly amazed you—not just as a product, but as a thoughtful tool for…
In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…