Detailed explanation of php metaphone() function and php localeconv() function examples

墨辰丷
Release: 2023-03-29 13:50:01
Original
986 people have browsed it

This article mainly introduces the relevant information about the php metaphone() function and php localeconv() function instance analysis. Friends in need can refer to the

php metaphone() function to calculate the metaphone key of a string. This article introduces the basic usage and examples of the php metaphone() function to coders. Coders in need can refer to the methods and examples in this article.

Definition and Usage

metaphone() function calculates the metaphone key of a string.

The metaphone key represents the English pronunciation of the string.

Themetaphone() function can be used in spell checkers.

Note: The metaphone() function creates the same key for words with similar pronunciation.

Note: The generated metaphone keys are of variable length.

Tip: metaphone() is more precise than the soundex() function because metaphone() understands the basic rules of English pronunciation

Grammar


The code is as follows:

metaphone(string,length)
Copy after login
ParametersDescription
stringRequired. Specifies the string to check.
length Optional. Specifies the maximum length of metaphone keys.

technical details

Return value: If successful, return the metaphone key of the string, if failed, return FALSE.
PHP version: 4

实例

例子 1

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

";
echo metaphone($str);
?>
Copy after login

例子 2

使用 length 参数:

";
echo metaphone($str2,5);
?>
Copy after login

关于php metaphone()函数解析就给大家介绍这么多。

下面给大家介绍php localeconv() 函数实例解析,具体详情如下所示:

php localeconv() 函数返回一包含本地数字及货币格式信息的数组。本文章向码农介绍php localeconv() 函数的使用方法和基本实例。需要的码农可以参考一下。

定义和用法

localeconv() 函数返回一包含本地数字及货币格式信息的数组。

localeconv() 函数会返回以下数组元素:

[decimal_point] - 小数点字符
[thousands_sep] - 千位分隔符
[int_curr_symbol] - 货币符号 (例如:USD)
[currency_symbol] - 货币符号 (例如:$)
[mon_decimal_point] - 货币小数点字符
[mon_thousands_sep] - 货币千位分隔符
[positive_sign] - 正值字符
[negative_sign] - 负值字符
[int_frac_digits] - 国际通用小数位
[frac_digits] - 本地通用小数位
[p_cs_precedes] - 如果货币符号在一个正数值之前显示,则为 True(1),如果在正数值之后显示,则为 False(0)
[p_sep_by_space] - 如果在货币符号和正数值之间包含空格,则为 True(1),否则为 False(0)
[n_cs_precedes] - 如果货币符号在一个负数值之前显示,则为 True(1),如果在负数值之后显示,则为 False(0)
[n_sep_by_space] - 如果在货币符号和负数值之间包含空格,则为 True(1),否则为 False(0)
[p_sign_posn] - 格式化选项:
0 - 把数量和货币符号写在圆括号内
1 - 在数量和货币符号之前加上 + 号
2 - 在数量和货币符号之后加上 + 号
3 - 直接在货币符号之前加上 + 号
4 - 直接在货币符号之后加上 + 号
[n_sign_posn] - 格式化选项:
0 - 把数量和货币符号写在圆括号内
1 - 在数量和货币符号之前加上 - 号
2 - 在数量和货币符号之后加上 - 号
3 - 直接在货币符号之前加上 - 号
4 - 直接在货币符号之后加上 - 号
[grouping] - 显示数字组合形式的数组(例如:3 指示 1 000 000)
[mon_grouping] - 显示货币数字组合形式的数组(例如:2 指示 1 00 00 00)

提示:如需定义本地设置,请参阅 setlocale() 函数。

提示:如需参阅所有可用的语言代码,请访问我们的语言代码参考手册。

语法


代码如下:

localeconv()
Copy after login

技术细节

返回值:返回基于由 setlocale() 设置的当前本地的数据。
PHP 版本:4.0.5+

实例

查找美国本地的数字格式化信息:

Copy after login

总结:以上就是本篇文的全部内容,希望能对大家的学习有所帮助。

相关推荐:

PHP仿微信多图片预览上传实例详解

PHP入门教程之图像处理技巧实例分享

php实现姓名根据首字母排序的类与方法

The above is the detailed content of Detailed explanation of php metaphone() function and php localeconv() function examples. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!