I want to sort an array in php which contains german 'umlaute'. This does not seem to be an easy task for php. I found the following example on the web:
$oldLocale=setlocale(LC_COLLATE, "0");
setlocale(LC_COLLATE, 'de_DE.utf8');
usort($countrys, 'strcoll');
setlocale(LC_COLLATE, $oldLocale);
This is working as expected. My question now is, what is the scope of setlocale? Is it limited to the current function I am in, is it limited to my thread, my session or is it global?
I am afraid of creating race conditions, but I cannot find any other information on this than:
The setlocale() function sets locale information.
It will be a global setting, it keeps set the last value while the script is running. It's not related to sessions, it's scope is the php process itself.
http://php.net/manual/en/function.setlocale.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With