soundex

(PHP 4, PHP 5, PHP 7)

soundexCalculate the soundex key of a string

说明

soundex ( string $str ) : string

Calculates the soundex key of str.

Soundex keys have the property that words pronounced similarly produce the same soundex key, and can thus be used to simplify searches in databases where you know the pronunciation but not the spelling. This soundex function returns a string 4 characters long, starting with a letter.

This particular soundex function is one described by Donald Knuth in "The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392.

参数

str

The input string.

返回值

Returns the soundex key as a string.

范例

Example #1 Soundex Examples

<?php
soundex
("Euler")       == soundex("Ellery");    // E460
soundex("Gauss")       == soundex("Ghosh");     // G200
soundex("Hilbert")     == soundex("Heilbronn"); // H416
soundex("Knuth")       == soundex("Kant");      // K530
soundex("Lloyd")       == soundex("Ladd");      // L300
soundex("Lukasiewicz") == soundex("Lissajous"); // L222
?>

参见

相关文章
php dba 函数 splits a key in string representation into array representationphp gnupg 函数 add a key for encryptionphp 字符串 函数 转换十六进制字符串为二进制字符串php gd 和图像处理 函数 垂直地画一行字符串php imap 函数 parse mail headers from a stringphp 网络 函数 将长整型转化为字符串形式带点的互联网标准格式地址(ipv4)php mcve 函数 set certificate key files and certificates if server requires client certificate verificationphp 多字节字符串 函数 encode character to html numeric string referencephp 多字节字符串 函数 regular expression match for multibyte stringphp 多字节字符串 函数 setup string and regular expression for a multibyte regular expression matchphp 多字节字符串 函数 returns position and length of a matched part of the multibyte regular expression for a predefined multibyte stringphp 多字节字符串 函数 multibyte regular expression match for predefined multibyte stringphp 多字节字符串 函数 检测 http 输入字符编码php 多字节字符串 函数 大小写不敏感地查找字符串在另一个字符串中首次出现的位置php 字符串 函数 calculate the metaphone key of a stringphp mysql 函数 转义 sql 语句中使用的字符串中的特殊字符,并考虑到连接的当前字符集php ncurses 函数 check for presence of a function key on terminal keyboardphp 字符串 函数 convert html entities to their corresponding charactersphp 字符串 函数 calculate the soundex key of a stringphp 字符串 函数 return a formatted string
关注编程学问公众号