67
PHP metaphone() function
PHP metaphone() function is predefined function. It is used to calculate the metaphone key of a string. It is useful to text search and text matching application.
It is phonetic algorithm developed by Lawrence Philips. The algorithm produces variable length keys as output.
Syntax:
Parameter | Description | Required/Optional |
---|---|---|
String | Specify input string. | Required |
Length | Specify the max length of the megaphones key. | Optional |
Example 1
Output:
Before using metaphone() function:Hello PHP After using metaphone() function: HLFP
Example 2
Output:
NS NS
Example 3
Output:
string(7) "PRKRMNK" string(6) "PRKRMR"
Example 4
Output:
NS NS
Note: Given above example by using the length of parameter.
Next TopicPHP String