当前位置: 首页> 函数类别大全> 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 必需。规定要检查的字符串。
同类函数
  • 将8位字符串转换为带引号的可打印字符串 quoted_printable_encode

    quoted_printable_encode

    将8位字符串转换为带引号的可打印字符串
  • 单向字符串散列 crypt

    crypt

    单向字符串散列
  • 返回格式化的字符串 sprintf

    sprintf

    返回格式化的字符串
  • 使用另一个字符串将字符串填充到某个长度 str_pad

    str_pad

    使用另一个字符串将字符串填充到某个长度
  • 查找字符串的首次出现 strstr

    strstr

    查找字符串的首次出现
  • 将特殊字符转换为HTML实体 htmlspecialchars

    htmlspecialchars

    将特殊字符转换为HTML实体
  • 在字符串中查找一组字符的任何一个字符-返回一个以找到的字符开始的子字符串 strpbrk

    strpbrk

    在字符串中查找一组字符的任何一个字符-返
  • 使用一个字符串分割另一个字符串为数组 explode

    explode

    使用一个字符串分割另一个字符串为数组
热门文章