If you are looking for a getlocale() function simply pass 0 (zero) as the second parameter to setlocale().
Beware though if you use the category LC_ALL and some of the locales differ as a string containing all the locales is returned:
<?php
echo setlocale(LC_ALL, 0);
echo setlocale(LC_CTYPE, 0);
setlocale(LC_ALL, "en_US.UTF-8");
echo setlocale(LC_ALL, 0);
?>
If you are looking to store and reset the locales you could do something like this:
<?php
$originalLocales = explode(";", setlocale(LC_ALL, 0));
setlocale(LC_ALL, "nb_NO.utf8");
foreach ($originalLocales as $localeSetting) {
if (strpos($localeSetting, "=") !== false) {
list ($category, $locale) = explode("=", $localeSetting);
}
else {
$category = LC_ALL;
$locale = $localeSetting;
}
setlocale($category, $locale);
}
?>
The above works here (Ubuntu Linux) but as the setlocale() function is just wrapping the equivalent system calls, your mileage may vary on the result.