PHP nl_langinfo() Function

Definition and Usage

The nl_langinfo() function returns specific local information.

Note:This function is not applicable to the Windows platform.

Tip:Unlike the localeconv() function that returns all localized formatting information, the nl_langinfo() function returns specific information.

Syntax

nl_langinfo(element)
Parameter Description
element

Required. Specifies which element to return. It must be one of the following elements:

Time and Calendar:

  • ABDAY_(1-7) - Abbreviation for the day name in a week
  • DAY_(1-7) - Abbreviation for the day name in a week (DAY_1 = Sunday)
  • ABMON_(1-12) - Abbreviation for the month name in a year
  • MON_(1-12) - Represents the name of each month in a year
  • AM_STR - String representing the morning
  • PM_STR - String representing the afternoon
  • D_T_FMT - Format string for date and time, usable for strftime()
  • D_FMT - Format string for date, usable for strftime()
  • T_FMT - Format string for time, usable for strftime()
  • T_FMT_AMPM - Format string for 12-hour time with AM/PM, usable for strftime()
  • ERA - Century conversion
  • ERA_YEAR - Century conversion format represented by year
  • ERA_D_T_FMT - Century conversion format represented by date and time (a string that can be used in strftime())
  • ERA_D_FMT - Century conversion format represented by date (a string that can be used in strftime())
  • ERA_T_FMT - Century conversion format represented by time (a string that can be used 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 - Currency decimal point character
  • MON_THOUSANDS_SEP - Currency thousands separator
  • POSITIVE_SIGN - Character for positive values
  • NEGATIVE_SIGN - Character for negative values
  • MON_GROUPING - Array showing the grouping form of currency numbers (e.g., 1 000 000)
  • INT_FRAC_DIGITS - International decimal digits for general use
  • FRAC_DIGITS - Local decimal digits for general use
  • P_CS_PRECEDES - True (1) if the currency symbol is displayed before a positive value, otherwise False (0) if it is displayed after the positive value
  • P_SEP_BY_SPACE - True (1) if there is a space between the currency symbol and a positive value, otherwise False (0)
  • N_CS_PRECEDES - True (1) if the currency symbol is displayed before a negative value, otherwise False (0) if it is displayed after the negative value
  • N_SEP_BY_SPACE - True (1) if there is a space between the currency symbol and a negative value, otherwise False (0)
  • P_SIGN_POSN - Format setting, possible return values:
    • 0 - Write the quantity and currency symbol within parentheses
    • 1 - Add a plus sign before the quantity and currency symbol
    • 2 - Add a plus sign after the quantity and currency symbol
    • 3 - Directly add a plus sign before the currency symbol
    • 4 - Directly add a plus sign after the currency symbol
  • N_SIGN_POSN - Format setting, possible return values:
    • 0 - Write the quantity and currency symbol within parentheses
    • 1 - Add a minus sign before the quantity and currency symbol
    • 2 - Add a minus sign after the quantity and currency symbol
    • 3 - Directly add a minus sign before the currency symbol
    • 4 - Directly add a minus sign after the currency symbol

Number Category:

  • DECIMAL_POINT - Decimal point character
  • RADIXCHAR - Similar to DECIMAL_POINT
  • THOUSANDS_SEP - Thousand separator character
  • THOUSEP - Similar to THOUSANDS_SEP
  • GROUPING - Displays an array in the form of number grouping (e.g., 1,000,000)

Communication Category:

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

Code Set Category:

  • CODESET returns a string with the character encoding name.

Technical Details

Return Value: Returns the specified information if successful, returns FALSE if failed.
PHP Version: 4.1.0+