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';