當前位置: 首頁> 函數類別大全> soundex

soundex

計算字符串的soundex鍵
名稱:soundex
分類:字符串
所屬語言:php
一句話介紹:計算字符串的soundex 鍵。

定義和用法

soundex()函數計算字符串的soundex 鍵。

soundex 鍵是4 字符長的字母數字字符串,表示單詞的英文發音。

soundex()函數可用於拼寫檢查應用程序。

註釋: soundex()函數為發音相似的單詞創建相同的鍵。

提示: metaphone()soundex()函數更精確,因為metaphone()了解英語發音的基本規則。

實例

例子1

計算"Hello" 的soundex 鍵:

 <?php
$str = "Shanghai" ;
echo soundex ( $str ) ;
?>

親自試一試

例子2

對兩個發音相似的單詞使用soundex() 函數:

 <?php
$str = "Assistance" ;
$str2 = "Assistants" ;

echo soundex ( $str ) ;
echo "<br>" ;
echo soundex ( $str2 ) ;
?>

親自試一試

文法

soundex ( string )
參數 描述
string 必需。規定要檢查的字符串。
同類函數
  • 計算子字符串出現次數 substr_count

    substr_count

    計算子字符串出現次數
  • 計算字符串中全部字符都存在於指定字符集合中的第一段子串的長度 strspn

    strspn

    計算字符串中全部字符都存在於指定字符集合
  • 檢查字符串是否以給定的子字符串開頭 str_starts_with

    str_starts_with

    檢查字符串是否以給定的子字符串開頭
  • 獲取數字格式信息 localeconv

    localeconv

    獲取數字格式信息
  • 輸出一個或多個字符串 echo

    echo

    輸出一個或多個字符串
  • 將字符串轉化為大寫 strtoupper

    strtoupper

    將字符串轉化為大寫
  • 返回有關字符串中使用的字符的信息-統計string 中每個字節值(0..255)出現的次數 count_chars

    count_chars

    返回有關字符串中使用的字符的信息-統計s
  • 計算字符串的metaphone鍵 metaphone

    metaphone

    計算字符串的metaphone鍵
熱門文章