soundex
(PHP3 , PHP4)
soundex --- 计算字符串的发音键
语法 :
string soundex
(string str)说明 :
计算字符串 str的发音键(soundex key)值。
发音键有个特性是,相同发音的单字会产生出相同的发音键。如果你知道单字的发音但是确不知道拼法时,你就可以使用这个特性,在资料库中作个简单的搜寻。此函数会传回一个4字元长的字符串,字符串的开头是个字母。
这个特殊的函数由Donald Knuth叙述在"The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392。
Example :
soundex ("Euler") == soundex ("Ellery") == 'E460';
soundex ("Gauss") == soundex ("Ghosh") == 'G200';
soundex ("Knuth") == soundex ("Kant") == 'H416';
soundex ("Lloyd") == soundex ("Ladd") == 'L300';
soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222';