PHP nl_langinfo()Functions


PHP String 参考手册PHP String Reference Manual

Definition and Usage

The nl_langinfo() function returns specified local information.

Note:This function does not work on Windows platforms.

Tip:Unlike thelocaleconv()function that returns all local formatting information, nl_langinfo() returns the specified information.


Syntax

nl_langinfo(element)

Parameter Description
element Required. Specifies which element to return. Must be one of the following listed elements:

Time and Calendar:

  • ABDAY_(1-7) - Abbreviated names for each day of the week
  • DAY_(1-7) - Names for each day of the week (DAY_1 = Sunday)
  • ABMON_(1-12) - Abbreviated names for each month of the year
  • MON_(1-12) - Names for each month of the year
  • AM_STR - String representing the morning (AM)
  • PM_STR - String representing the afternoon (PM)
  • D_T_FMT - Format string for date and time, usable with strftime()
  • D_FMT - Format string for date, usable with strftime()
  • T_FMT - Format string for time, usable with strftime()
  • T_FMT_AMPM - Format string for 12-hour time with AM/PM, usable with strftime()
  • ERA - Era conversion
  • ERA_YEAR - Era conversion format expressed in years
  • ERA_D_T_FMT - Era conversion format expressed as date and time (string usable in strftime())
  • ERA_D_FMT - Era conversion format expressed as date (string usable in strftime())
  • ERA_T_FMT - Era conversion format expressed as time (string usable in strftime())

Currency Category:

  • INT_CURR_SYMBOL - Currency symbol (e.g., USD)
  • CURRENCY_SYMBOL - Currency symbol (e.g., $)
  • CRNCYSTR - Similar to CURRENCY_SYMBOL
  • MON_DECIMAL_POINT - Monetary decimal point character
  • MON_THOUSANDS_SEP - Monetary thousands separator
  • POSITIVE_SIGN - Positive value character
  • NEGATIVE_SIGN - Negative value character
  • MON_GROUPING - Array showing the grouping format of monetary numbers (e.g., 1 000 000)
  • INT_FRAC_DIGITS - International common fractional digits
  • FRAC_DIGITS - Local common fractional digits
  • P_CS_PRECEDES - True (1) if the currency symbol appears before a positive value; False (0) if it appears after the positive value
  • P_SEP_BY_SPACE - True (1) if there is a space between the currency symbol and the positive value; otherwise False (0)
  • N_CS_PRECEDES - True (1) if the currency symbol appears before a negative value; False (0) if it appears after the negative value
  • 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 - Format setting, possible return values:
    • 0 - Put the amount and currency symbol in parentheses
    • 1 - Add a + sign before the amount and currency symbol
    • 2 - Add a + sign after the amount and currency symbol
    • 3 - Add a + sign directly before the currency symbol
    • 4 - Add a + sign directly after the currency symbol
  • N_SIGN_POSN - Format setting, possible return values:
    • 0 - Put the amount and currency symbol in parentheses
    • 1 - Add a - sign before the amount and currency symbol
    • 2 - Add a - sign after the amount and currency symbol
    • 3 - Add a - sign directly before the currency symbol
    • 4 - Add a - sign directly after the currency symbol

Numeric Category:

  • DECIMAL_POINT - Decimal point character
  • RADIXCHAR - Similar to DECIMAL_POINT
  • THOUSANDS_SEP - Thousands separator character
  • THOUSEP - Similar to THOUSANDS_SEP
  • GROUPING - Array showing the grouping format of numbers (e.g., 1 000 000)

Communication Category:

  • YESEXPR - Regex string matching 'yes' input
  • NOEXPR - Regex string matching 'no' input
  • YESSTR - Output string for 'yes'
  • NOSTR - Output string for 'no'

Code Set Category:

  • CODESET returns a string with the name of the character encoding.

Technical Details

Return Value: Returns the specified information on success, or FALSE on failure.
PHP Version: 4.1.0+


PHP String 参考手册PHP String Reference Manual Other Extensions