|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-28 18:45 UTC] felipe@php.net
[2009-06-29 02:50 UTC] brettz9 at yahoo dot com
[2009-06-29 03:32 UTC] felipe@php.net
[2009-06-29 03:35 UTC] brettz9 at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 23:00:01 2025 UTC |
Description: ------------ The source for metaphone() states in the comments that "WH becomes H" and when one tests it, e.g., with "whit", as per the comment on line 227 and the code which phonizes Next_Letter on line 233 when there is a 'W' followed by 'H', it returns 'H' ("ht" for 'whit'). However, according to the metaphone() algorithm (see http://aspell.net/metaphone/ and the original implementation at http://aspell.net/metaphone/metaphone.basic ), 'wh' should become 'w', not 'h'. So, to fix it, you could change the comment on 233 to: /* WH becomes W, and then change the 'if' on 231-234 to: if (Next_Letter == 'H') { Phonize('W'); w_idx += 2; } else if (Next_Letter == 'R') { Phonize(Next_Letter); w_idx += 2; Reproduce code: --------------- <?php echo metaphone('Whit'); ?> Expected result: ---------------- WT Actual result: -------------- HT