Monday, 29 September 2014

setlocale in PHP

PHP setlocale() function returns locale information like language, monetary, time and other information specific for a geographical area.

Syntax:

setlocale(constant,location)
constant : Required. Defines what locale information should be set.

location : Required. Defines what country/region to set the locale information to.

Note : The setlocale() function updates the locale just for the present script. 

Tip : The locale information can be set to system default with setlocale (LC_ALL, NULL).

Example:

<?php
echo setlocale(LC_ALL,"En-Us");
echo "<br />";
echo setlocale(LC_ALL,NULL);
?>
Output will be:
English_United States.1252
English_United States.1252

0 comments:

Post a Comment