note 85877 added to function.setlocale
| From: | alvaro at demogracia dot com | Date: | Mon, 22 Sep 2008 16:33:02 +0000 |
| Subject: | note 85877 added to function.setlocale | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144614@lists.php.net to get a copy of this message | ||
A generalization for mk (26-Jan-2004) and totu (09-Sep-2002). The issue is not restricted to MySQL.
For instance, when PHP needs to cast a floating point variable to string, it obeys the LC_NUMERIC
settings:
<?php
$foo = 29.95;
echo "Locale: " . setlocale(LC_NUMERIC, 0) . "\n";
echo "Foo: $foo\n";
setlocale(LC_NUMERIC, 'Spanish_Spain.28605');
echo "Locale: " . setlocale(LC_NUMERIC, 0) . "\n";
echo "Foo: $foo\n";
?>
Under Windows, this code prints:
Locale: C
Foo: 29.95
Locale: Spanish_Spain.28605
Foo: 29,95
----
Server IP: 130.206.1.5
Probable Submitter: 80.37.14.51
----
Manual Page -- http://www.php.net/manual/en/function.setlocale.php
Edit -- https://master.php.net/note/edit/85877
Del: integrated -- https://master.php.net/note/delete/85877/integrated
Del: useless -- https://master.php.net/note/delete/85877/useless
Del: bad code -- https://master.php.net/note/delete/85877/bad+code
Del: spam -- https://master.php.net/note/delete/85877/spam
Del: non-english -- https://master.php.net/note/delete/85877/non-english
Del: in docs -- https://master.php.net/note/delete/85877/in+docs
Del: other reasons-- https://master.php.net/note/delete/85877
Reject -- https://master.php.net/note/reject/85877
Search -- https://master.php.net/manage/user-notes.php