note 99272 deleted from function.setlocale by bjori
| From: | bjori@php.net | Date: | Thu, 08 Dec 2011 10:28:59 +0000 |
| Subject: | note 99272 deleted from function.setlocale by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184973@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Anyone looking for a getlocale() function like me, here it is.
If you want change locale for a part of your code and then you want to restore the original locale
(and you don't know what it was) this is how you can do it:
<?php
function getlocale($category) {
return setlocale($category, NULL);
}
$old_locale = getlocale(LC_ALL);
setlocale(LC_ALL, "de_DE");
// now use the geman locale
setlocale(LC_ALL, $old_locale);
// now use the original locale
?>