PHP Metaphone () function and PHP localeconv () function instance parsing

Source: Internet
Author: User
Tags define local
PHP Metaphone () function calculates the Metaphone key of the string, this article introduces the basic usage and example of PHP Metaphone () function to the code farmers, the code farmer can refer to the methods and examples of this article.

Definition and usage

The Metaphone () function computes the Metaphone key for the string.

The Metaphone key represents the English pronunciation of the string.

The Metaphone () function is useful for spell checker.

Note: the Metaphone () function creates the same key for a word that sounds similar.

Note: The resulting metaphone key length is variable.

Tip: Metaphone () is more accurate than the SOUNDEX () function because Metaphone () understands the basic rules of English pronunciation

Grammar

Metaphone (String,length)

Technical details

Instance

Example 1

Use the Metaphone () function for two words that are similar in pronunciation:

<?PHP$STR = "assistance"; $str = "assistants"; Echo Metaphone ($STR); echo "<br>"; Echo Metaphone ($STR); >

Example 2

Use the length parameter:

<?PHP$STR = "Assistance", $str 2 = "assistants", Echo Metaphone ($str, 5), echo "<br>", Echo metaphone ($str 2,5);? >

About PHP Metaphone () function parsing will introduce you so much.

Here is a description of PHP localeconv () Function instance parsing, 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 example of PHP localeconv () function to code farming. Need to the code farmers can refer to.

Definition and usage

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

The Localeconv () function returns the following array element:

[Decimal_point]-decimal character
[THOUSANDS_SEP]-Thousands separator
[int_curr_symbol]-Currency symbol (ex: USD)
[currency_symbol]-Currency symbol (For example: $)
[mon_decimal_point]-Currency decimal character
[mon_thousands_sep]-Currency thousand separator
[positive_sign]-positive character
[negative_sign ]-negative character
[Int_frac_digits]-International Universal decimal Place
[Frac_digits]-Local general-purpose decimal Place
[P_cs_precedes]-True If the currency symbol is displayed before a positive value (1), False if displayed after a positive value (0)
[p_sep_by_space]-True (1) If a space is included between the currency symbol and the positive value, False (0)
[n_cs_precedes]- True (1) If the currency symbol is displayed before a negative value, or False (0)
[n_sep_by_space] If it is displayed after a negative value-True (1) If a space is included between the currency symbol and the negative value, or False (0)
[P_sign_posn]-formatting options:
0-Write the quantity and currency symbol in parentheses
1-precede the quantity and currency symbol with the + sign
2-After the quantity and currency symbol plus the + sign
3-directly precede the currency symbol with the + sign
4-Directly after the currency symbol with the + sign
[n_sign_posn]-formatting options:
0-Write the quantity and currency symbol in parentheses
1-precede the quantity and currency symbol with a number
2-After the quantity and currency symbol plus-number
3 -Directly before the currency symbol Plus-No.
4-directly after the currency symbol plus-sign
[grouping]-displays an array of numeric combinations (for example: 3 indicates 1)
[mon_grouping]-Displays an array of currency number combinations ( Example: 2 indicates 1 xx)

Tip: If you need to define local settings, see the setlocale () function.

Tip: To see all available language codes, please visit our Language Code reference manual.

Grammar

Localeconv ()

Technical details

Instance

Find local digital formatting information for the United States:

<?phpsetlocale (Lc_all, "US"), $locale _info = Localeconv ();p rint_r ($locale _info);? >

The above mentioned is the PHP Metaphone () function and PHP localeconv () Function instance parsing, we hope to help!

Related Article

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.