PHP 教程
metaphone() 函數(shù)計(jì)算字符串的 metaphone 鍵。
metaphone 鍵代表了字符串的英語(yǔ)發(fā)音。
metaphone() 函數(shù)可用于拼寫(xiě)檢查程序。
注釋?zhuān)?/b>metaphone() 函數(shù)為發(fā)音相似的單詞創(chuàng)建相同的鍵。
注釋?zhuān)?/b>所生成的 metaphone 鍵長(zhǎng)度可變。
提示:metaphone() 比 soundex() 函數(shù)更精確,因?yàn)?metaphone() 了解英語(yǔ)發(fā)音的基本規(guī)則。
參數(shù) | 描述 |
---|---|
string | 必需。規(guī)定要檢查的字符串。 |
length | 可選。規(guī)定 metaphone 鍵的最大長(zhǎng)度。 |
返回值: | 如果成功則返回字符串的 metaphone 鍵,如果失敗則返回 FALSE。 |
---|---|
PHP 版本: | 4+ |
對(duì)兩個(gè)發(fā)音相似的單詞使用 metaphone() 函數(shù):
使用 length 參數(shù):