PHP setlocale Function
What is setlocale Function?
Explanation
In PHP this function is used to set locale information.
Syntax:
setlocale(constant,location)
In the above syntax "constant" specifies the constants used in the function, "location" specifies the country or region for which locale information is required.
The following table displays the constants that can be used
CONSTANT | DESCRIPTION |
LC_ALL | All of the below |
LC_COLLATE | Sort order |
LC_CTYPE | Character classification and conversion |
LC_MESSAGES | System message formatting |
LC_MONETARY | Monetary/currency formatting |
LC_NUMERIC | Numeric formatting |
LC_TIME | Date and time formatting |
Example :
<?php
echo setlocale(LC_ALL,"En-Us");
echo "<br />";
echo setlocale(LC_ALL,NULL);
?>
Result :
English_United States.1252
English_United States.1252
In the above example both the default and the specified setlocale settings are same.