How to calculate the metaphone key of a string in PHP

3 Answers

0 votes
// Metaphone is a phonetic algorithm, published by Lawrence Philips in 1990, 
// for indexing words by their English pronunciation. 

// string metaphone( string $str [, int $phonemes = 0 ])

var_dump(metaphone('PHP Programming'));


/*
run: 

string(9) "FPPRKRMNK" 

*/

 



answered Jul 5, 2016 by avibootz
0 votes
// Metaphone is a phonetic algorithm, published by Lawrence Philips in 1990, 
// for indexing words by their English pronunciation. 

// string metaphone( string $str [, int $phonemes = 0 ])

var_dump(metaphone('PHP'));


/*
run: 

string(2) "FP" 

*/

 



answered Jul 5, 2016 by avibootz
0 votes
// Metaphone is a phonetic algorithm, published by Lawrence Philips in 1990, 
// for indexing words by their English pronunciation. 

// string metaphone( string $str [, int $phonemes = 0 ])

echo "<pre>";
var_dump(metaphone('PHP Programming', 5));   // 5 phonemes characters length
var_dump(metaphone('Programming', 5));
echo "</pre>";


/*
run: 

string(5) "FPPRK"
string(5) "PRKRM"

*/

 



answered Jul 5, 2016 by avibootz

Related questions

...