PHP string setlocale() Function

The string setlocale() function is in-built function of PHP. It is used to set local information. It returns the new current locale and False if the locale functionality is not implemented.

Note: It returns value depends on the system.

Syntax:

ParameterDescriptionRequired/Optional
constantSpecify the local information to be set. Following constant:
  • LC_ALL: For all of the below
  • LC_COLLATE: Sort order
  • LC_CTYPE: Character classification and conversion (e.g. all characters should be lower or upper-case)
  • LC_MESSAGES: System message formatting
  • LC_MONETARY: Monetary/currency formatting
  • LC_NUMERIC: Numeric formatting
  • LC_TIME: Date and time formatting
required
LocationSpecify what country/region to set the local information.Required

Example 1

Output:

Your Location is:US
By using setlocale() function:English_United States.1252

Example 2

Output:

Your Location is: NULL
By using setlocale() function:English_United States.1252

Next TopicPHP String




Latest Courses