How to use metaphone in PHP

In this article I will explain how the metaphone() function can be used in PHP.
  • 1536

metaphone() function in PHP

  • The metaphone() function is used to calculate the metaphone key of a string.
  • The metaphone() function can be used for spelling applications.
  • The metaphone() function uses a larger set of rules for English pronunciation.
  • In metaphone() function, Metaphone keys are very useful for text search and text matching applications.
  • The metaphone() function creates the same key for similar sounding words
  • The metaphone() function returns the metaphone key of the string on success, or FALSE on failure.




  • string string is required parameter. It determine check to string.
  • length length is optional parameter. determine maximum length of the metaphone key.


The following example show to how the metaphone() function can be used in PHP.



<h3 style="color: Blue;">metaphone() function example in PHP</h3>


    $str = "C-sharpcorner";

    echo $str;

    echo "<br />";

    $str1 = "Dotnetheaven";

    $str2 = "Modelingcorner";

    echo metaphone($str1);

    echo "<br />";

    echo metaphone($str2);






You may also want to read these related articles here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.