note 79559 added to function.setlocale
| From: | weboide | Date: | Mon, 03 Dec 2007 10:10:57 +0000 |
| Subject: | note 79559 added to function.setlocale | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132765@lists.php.net to get a copy of this message | ||
Be careful when TYPECASTING using DIFFERENT LOCALES :
<?php
# WITHOUT LOCALE OR US_EN LOCALE :
var_dump((float)(string)9.2); # returns : float(9.2) (AS EXPECTED)
# WITH LOCALES USING a COMMA for floating part separator :
setlocale(LC_ALL, 'fr_FR');
var_dump((float)(string)9.2); # returns : float(9) (NOT EXPECTED AT ALL !!! CAREFUL!!)
?>
Any solution to this problem is welcomed.
----
Server IP: 217.174.196.197
Probable Submitter: 86.64.70.76
----
Manual Page -- http://www.php.net/manual/en/function.setlocale.php
Edit -- https://master.php.net/note/edit/79559
Del: integrated -- https://master.php.net/note/delete/79559/integrated
Del: useless -- https://master.php.net/note/delete/79559/useless
Del: bad code -- https://master.php.net/note/delete/79559/bad+code
Del: spam -- https://master.php.net/note/delete/79559/spam
Del: non-english -- https://master.php.net/note/delete/79559/non-english
Del: in docs -- https://master.php.net/note/delete/79559/in+docs
Del: other reasons-- https://master.php.net/note/delete/79559
Reject -- https://master.php.net/note/reject/79559
Search -- https://master.php.net/manage/user-notes.php