downloads | documentation | faq | getting help | mailing lists | reporting bugs | sites | links | my 
search for in the  
Last updated: Mon, 16 Jul 2012


(PHP 3, PHP 4, PHP 5)

soundex -- Calculate the soundex key of a string


string soundex ( string str )

Calculates the soundex key of str.

Soundex keys have the property that words pronounced similarly produce the same soundex key, and can thus be used to simplify searches in databases where you know the pronunciation but not the spelling. This soundex function returns a string 4 characters long, starting with a letter.

This particular soundex function is one described by Donald Knuth in "The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392.

例子 1. Soundex Examples

("Euler")      == soundex("Ellery");    // E460
soundex("Gauss")      == soundex("Ghosh");    // G200
soundex("Hilbert")    == soundex("Heilbronn"); // H416
soundex("Knuth")      == soundex("Kant");      // K530
soundex("Lloyd")      == soundex("Ladd");      // L300
soundex("Lukasiewicz") == soundex("Lissajous"); // L222

See also levenshtein(), metaphone(), and similar_text().

 Last updated: Mon, 16 Jul 2012
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at:
Last updated: Thu Jul 7 19:13:47 2005 CST