PHP 8.5.0 Alpha 2 available for testing

Voting

: five plus three?
(Example: nine)

The Note You're Voting On

tim dot peters at live dot com
6 years ago
Maybe obvious, but I would expect that setlocale constantes (LC_*) would be bitwise, but they're not.

In example, doing this:

<?php
setlocale
(LC_TIME + LC_COLLATE, 'nl');

echo
setlocale(LC_ALL, 0);
?>
would cause the following result:

LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=nl;LC_PAPER=C;
LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C

Note that LC_MESSAGES has changed, instead of LC_TIME and LC_COLLATE. (Because LC_TIME + LC_COLLATE = LC_MESSAGES).

Instead you would need to specify them individually, if you don't wish to use LC_ALL:

<?php
setlocale
(LC_TIME, 'nl');
setlocale(LC_COLLATE, 'nl');

echo
setlocale(LC_ALL, 0);
?> LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=nl;LC_COLLATE=nl;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;
LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C

<< Back to user notes page

To Top