PHP setlocale() Function
Complete PHP String Reference
Definition and Usage
The setlocale() function sets locale information.
Locale information is language, monetary, time and other information specific
for a geographical area.
This function returns the current locale settings, or FALSE on failure.
Syntax
|
setlocale(constant,location)
|
| Parameter |
Description |
| constant |
Required. Specifies what locale information should be set.
Available constants:
- LC_ALL - 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
|
| location |
Required. Specifies what country/region to set the locale
information to. Can be a string or an array. If the location is an array, setlocale() will try each array element until it finds a valid language or
region code. This is very useful if a region is known under different names
on different systems. Note: Here you can find
language and
region codes. |
Tips and Notes
Note: The setlocale() function changes the locale only for the current
script.
Tip: The
locale information can be set to system default with setlocale(LC_ALL,NULL)
Example
In this example we will set the locale to US English and then back to default
again:
<?php
echo setlocale(LC_ALL,"En-Us");
echo "<br />";
echo setlocale(LC_ALL,NULL);
?>
|
The output of the code above will be:
English_United States.1252
Norwegian (Bokmål)_Norway.1252
|
Complete PHP String Reference
Stylus Studio® 2010 XML Enterprise Suite raises the bar for productivity in XML development tools.
Millions of XML developers and data integration specialists turn to Stylus Studio's comprehensive and intuitive
XML toolset to tackle today's advanced XML data transformation and aggregation challenges.
|
- XML Pipeline Editor, Debugger and Code Generator
- DataDirect XML Converters
- XQuery Mapper, Editor, Debugger, and Profiler
- XSLT Mapper, Editor, Debugger, Designer, and Profiler
- Java and C# for .Net Code Generation
- XML Schema Designer With Documentation Generator
- XML Editor With Full XPath Integration
Download a free trial now
|
|