How to use metaphone in PHP

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

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.

Syntax

metaphone(string,length)

Parameter

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

Example

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

<html>

<body>

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

    <?php

    $str = "C-sharpcorner";

    echo $str;

    echo "<br />";

    $str1 = "Dotnetheaven";

    $str2 = "Modelingcorner";

    echo metaphone($str1);

    echo "<br />";

    echo metaphone($str2);

    ?>

</body>

</html>

 

Output

metaphone-php.gif
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
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.