1--TEST-- 2metaphone() tests 3--FILE-- 4<?php 5 6var_dump(metaphone("")); 7var_dump(metaphone(-1)); 8 9try { 10 var_dump(metaphone("valid phrase", -1)); 11} catch (ValueError $e) { 12 echo $e->getMessage(), "\n"; 13} 14var_dump(metaphone("valid phrase", 0)); 15var_dump(metaphone("valid phrase", 10000)); 16 17$array = array( 18"They fell forward, grovelling heedlessly on the cold earth.", 19"But the shadow of horror wheeled and returned, passing lower now, right above them, sweeping the fen-reek with its ghastly wings.", 20"And then it was gone, flying back to Mordor with the speed of the wrath of Sauron; and behind it the wind roared away, leaving the Dead Marshes bare and bleak.", 21"The naked waste, as far as the eye could pierce, even to the distant menace of the mountains, was dappled with the fitful moonlight." 22); 23 24foreach($array as $str) { 25 var_dump(metaphone($str)); 26} 27 28echo "Done\n"; 29?> 30--EXPECT-- 31string(0) "" 32string(0) "" 33metaphone(): Argument #2 ($max_phonemes) must be greater than or equal to 0 34string(6) "FLTFRS" 35string(6) "FLTFRS" 36string(26) "0FLFRWRTKRFLNKHTLSLN0KLTR0" 37string(56) "BT0XTFHRRHLTNTRTRNTPSNKLWRNRFTBF0MSWPNK0FNRKW0TSFSTLWNKS" 38string(69) "ANT0NTWSKNFLYNKBKTMRTRW00SPTF0R0FSRNNTBHNTT0WNTRRTWLFNK0TTMRXSBRNTBLK" 39string(56) "0NKTWSTSFRS0YKLTPRSFNT0TSTNTMNSF0MNTNSWSTPLTW00FTFLMNLFT" 40Done 41