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://codercto.com/courses/l/5.html

查看所有标签

Ruby on Rails Tutorial

Ruby on Rails Tutorial

Michael Hartl / Addison-Wesley Professional / 2012-8-6 / USD 44.99

"Ruby on Rails(TM) Tutorial by Michael Hartl has become a must-read for developers learning how to build Rails apps." -Peter Cooper, Editor of Ruby Inside Using Rails, developers can build web applica......一起来看看 《Ruby on Rails Tutorial》 这本书的介绍吧!

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

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具