Phpmetaphone () function and phplocaleconv () function instance parsing, localeconv_PHP tutorial

Source: Internet
Author: User
Phpmetaphone () function and phplocaleconv () function instance parsing, localeconv. Phpmetaphone () function and phplocaleconv () function instance parsing, localeconvphpmetaphone () function compute string metaphone key, this article introduces the php metaphone () function to the coders () function and php localeconv () function instance parsing, localeconv

The metaphone key of the php metaphone () function compute string. This article introduces the basic usage and example of the php metaphone () function to the coders, you can refer to the methods and examples in this article for the necessary coders.

Definition and usage

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

Metaphone indicates the English pronunciation of a string.

The metaphone () function can be used by spelling check programs.

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

Note: the length of the generated metaphone key is variable.

Tip: metaphone () is more accurate than soundex (), because metaphone () understands basic English pronunciation rules.

Syntax

The code is as follows:
Metaphone (string, length)

Parameters Description
String Required. Specifies the string to be checked.
Length Optional. Specifies the maximum length of the metaphone key.

Technical details

Return value: If the call succeeds, the metaphone key of the string is returned. if the call fails, FALSE is returned.
PHP version: 4 +

Instance

Example 1

Use the metaphone () function for two words with similar pronunciation:

<?php$str = "Assistance";$str = "Assistants";echo metaphone($str);echo "
";echo metaphone($str);?>

Example 2

Use the length parameter:

<?php$str = "Assistance";$str2 = "Assistants";echo metaphone($str,5);echo "
";echo metaphone($str2,5);?>

So much about the parsing of php metaphone () functions.

The following describes how to parse a php localeconv () function instance. The details are as follows:

The php localeconv () function returns an array containing local numbers and currency format information. This article introduces the usage and basic instances of the php localeconv () function to the coders. For more information about the coders, see.

Definition and usage

The localeconv () function returns an array containing local numbers and currency format information.

The localeconv () function returns the following array elements:

[Decimal_point]-decimal point character
[Thousands_sep]-thousands separator
[Int_curr_symbol]-currency symbol (for example, USD)
[Currency_symbol]-currency symbol (for example, $)
[Mon_decimal_point]-decimal point character in currency
[Mon_thousands_sep]-currency thousands separator
[Positive_sign]-positive character
[Negative_sign]-negative value character
[Int_frac_digits]-universal international scale
[Frac_digits]-general local decimal places
[P_cs_precedes]-if the currency symbol is displayed before a positive value, it is True (1). if it is displayed after a positive value, it is False (0)
[P_sep_by_space]-if there is a space between the currency symbol and the positive value, True (1); otherwise, False (0)
[N_cs_precedes]-if the currency symbol is displayed before a negative value, it is True (1). if it is displayed after a negative value, it is False (0)
[N_sep_by_space]-True (1) If there is a space between the currency symbol and the negative value; otherwise, False (0)
[P_sign_posn]-formatting options:
0-write the number and currency symbols in parentheses
1-add a plus sign before the number and currency symbol
2-add the plus sign after the number and currency symbol
3-add a plus sign directly before the currency symbol
4-add a plus sign directly after the currency symbol
[N_sign_posn]-formatting options:
0-write the number and currency symbols in parentheses
1-add the minus sign before the number and currency symbol
2-add the minus sign after the number and currency symbol
3-add the minus sign directly before the currency symbol
4-add the minus sign directly after the currency symbol
[Grouping]-displays arrays in the form of a combination of numbers (for example, 3 indicates 1 000 000)
[Mon_grouping]-displays an array in the form of a combination of currency numbers (for example, 2 indicates 1 00 00)

Tip: to define local settings, see setlocale () function.

Tip: If you need to refer to all available language codes, please visit our language code reference manual.

Syntax

The code is as follows:
Localeconv ()

Technical details

Return value: Returns the current local data set by setlocale.
PHP version: 4.0.5 +

Instance

Find the number formatting information in the United States:

<?phpsetlocale(LC_ALL,"US");$locale_info = localeconv();print_r($locale_info);?>

The above section describes how to parse the php metaphone () function and the php localeconv () function instance. I hope it will help you!

Http://www.bkjia.com/PHPjc/1127898.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1127898.htmlTechArticlephp metaphone () function and php localeconv () function instance parsing, localeconv php metaphone () function compute string metaphone key, this article introduces php metaphone () to coders () function...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.