PHP setlocale() Function

The setlocale() function in PHP sets locale information(language, monetary, time and, other information specific for a geographical area.)

Syntax

Parameter

category(required)- This parameter specified a named constant specifying the category of the functions affected by the locale setting. The constant list is as follow:

  • LC_ALL-  all of the below
  • LC_COLLATE- for string comparison
  • LC_CTYPE- for character classification and conversion
  • LC_MONETARY- for localeconv()
  • LC_NUMERIC- for decimal separator
  • LC_TIME- for date and time formatting with strftime()
  • LC_MESSAGES- for system responses

location(required)- This parameter specifies what country or region to set the locale information(string or an array). It is also possible to pass multiple locations.

Return

This function returns the new current locale, or FALSE if the specified locale functionality is not implemented on your platform, or if the locale does not exist or the category name is invalid.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This