PHP soundex() 函数

PHP 教程 · 2019-01-29 21:42:44

实例

计算 "Hello" 的 soundex 键:

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

定义和用法

soundex() 函数计算字符串的 soundex 键。

soundex 键是 4 字符长的字母数字字符串,表示一个单词的英文发音。

soundex() 函数可用于拼写检查程序。

注释:soundex() 函数为发音相似的单词创建相同的键。

提示: metaphone() 比 soundex() 函数更精确,因为 metaphone() 了解英语发音的基本规则。

语法

soundex(string)


参数 描述
string 必需。规定要检查的字符串。

技术细节

返回值: 如果成功则返回字符串的 soundex 键,如果失败则返回 FALSE。
PHP 版本: 4+

更多实例

实例 1

对两个发音相似的单词使用 soundex() 函数:

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

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

点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Web 2.0 Architectures

Web 2.0 Architectures

Duane Nickull、Dion Hinchcliffe、James Governor / O'Reilly / 2009 / USD 34.99

The "Web 2.0" phenomena has become more pervasive than ever before. It is impacting the very fabric of our society and presents opportunities for those with knowledge. The individuals who understand t......一起来看看 《Web 2.0 Architectures》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码