- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
metaphone() function in PHP
The metaphone() function is used to calculate the metaphone key of a string. This is a key that represent how a string sounds if spoken by someone who speaks in English.
Syntax
metaphone(str, len)
Parameters
str − The string to check.
len − The maximum length of the metaphone key.
Return
The metaphone() function returns the metaphone key of the string on success, or FALSE on failure.
Example
The following is an example −
<?php var_dump(metaphone('demo')); ?>
Output
The following is the output −
string(2) "TM"
Example
Let us see another example −
<?php var_dump(metaphone('Welcome', 3)); ?>
Output
The following is the output −
string(3) "WLK"
Example
Let us now see another example of the words that look similar −
<?php $one = "Since"; $two = "Sins"; echo metaphone($one); echo "<b>"; echo metaphone($two); ?>
Output
The following is the output −
SNS SNS
Advertisements
To Continue Learning Please Login
Login with Google