soundex
計算字符串的soundex鍵
soundex()
函數計算字符串的soundex 鍵。
soundex 鍵是4 字符長的字母數字字符串,表示單詞的英文發音。
soundex()
函數可用於拼寫檢查應用程序。
註釋: soundex()
函數為發音相似的單詞創建相同的鍵。
提示: metaphone()
比soundex()
函數更精確,因為metaphone()
了解英語發音的基本規則。
計算"Hello" 的soundex 鍵:
<?php $str = "Shanghai" ; echo soundex ( $str ) ; ?>
親自試一試
對兩個發音相似的單詞使用soundex() 函數:
<?php $str = "Assistance" ; $str2 = "Assistants" ; echo soundex ( $str ) ; echo "<br>" ; echo soundex ( $str2 ) ; ?>
親自試一試
soundex ( string )
參數 | 描述 |
---|---|
string | 必需。規定要檢查的字符串。 |