note 99272 added to function.setlocale
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 07 Aug 2010 17:18:44 +0000 |
| Subject: | note 99272 added to function.setlocale | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171453@lists.php.net to get a copy of this message | ||
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
?>
----
Server IP: 69.147.83.197
Probable Submitter: 195.113.97.174
----
Manual Page -- http://www.php.net/manual/en/function.setlocale.php
Edit -- https://master.php.net/note/edit/99272
Del: integrated -- https://master.php.net/note/delete/99272/integrated
Del: useless -- https://master.php.net/note/delete/99272/useless
Del: bad code -- https://master.php.net/note/delete/99272/bad+code
Del: spam -- https://master.php.net/note/delete/99272/spam
Del: non-english -- https://master.php.net/note/delete/99272/non-english
Del: in docs -- https://master.php.net/note/delete/99272/in+docs
Del: other reasons-- https://master.php.net/note/delete/99272
Reject -- https://master.php.net/note/reject/99272
Search -- https://master.php.net/manage/user-notes.php