函数名称:soundex()
适用版本:PHP 4, PHP 5, PHP 7
函数描述:soundex() 函数计算字符串的 soundex 键值。
语法:soundex(string $str): string
参数:
返回值:返回计算得到的 soundex 键值,如果输入的字符串无法计算 soundex 键值,则返回空字符串。
示例:
$str1 = "Hello";
$str2 = "World";
$str3 = "Hallo";
$soundex1 = soundex($str1);
$soundex2 = soundex($str2);
$soundex3 = soundex($str3);
echo "String: $str1, Soundex: $soundex1" . PHP_EOL;
echo "String: $str2, Soundex: $soundex2" . PHP_EOL;
echo "String: $str3, Soundex: $soundex3" . PHP_EOL;
输出:
String: Hello, Soundex: H400
String: World, Soundex: W643
String: Hallo, Soundex: H400
注意事项: