|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47443 metaphone('scratch') returns wrong result
Submitted: 2009-02-18 21:08 UTC Modified: 2009-02-18 22:38 UTC
From: sirokai at gmail dot com Assigned: felipe
Status: Closed Package: Strings related
PHP Version: 5.2CVS-2009-02-18 (CVS) OS: CentOS 5.2
Private report: No CVE-ID:
 [2009-02-18 21:08 UTC] sirokai at gmail dot com
When I run metaphone('scratch'), I get string(5) "SKRTX"

This is wrong. According to the rules posted for metaphone, T before CH is silent, so the result should be "SKRX". My Javascript metaphone function gets this right and I need the two to match up!

Reproduce code:
  echo metaphone("scratch");

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-18 21:18 UTC]
Exactly what algorithm does your JS func use?
 [2009-02-18 21:29 UTC] sirokai at gmail dot com

Line 227
 [2009-02-18 22:38 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

You are right according to Lawrence Philips' Metaphone Algorithm.

Fixed in 5.3 and HEAD.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 09:02:05 2015 UTC