note 65240 added to function.setlocale
| From: | acolomb at web dot de | Date: | Thu, 27 Apr 2006 12:18:40 +0000 |
| Subject: | note 65240 added to function.setlocale | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-109853@lists.php.net to get a copy of this message | ||
I've had problems with PHP not recognizing decimal numbers when run under Windows XP with
german locale. The following code explains the problem:
<?php
$a = 1.5;
$b = (float) "1.5";
$c = (float) "1,5";
echo "a:$a; b:$b; c:$c";
?>
It returned "a:1; b:1, c:1,5"
When setting the decimal point character in Windows Control Panel (Regional settings) to
".", it returned "a:1.5; b:1.5; c:1".
Setting the locale via setlocale(LC_NUMERICAL, "en") only had an effect on the number
output.
It seems to be a problem with the php_gtk.dll extension. When I commented out the
extension=php_gtk.dll line in php.in, the output was as expected. Apparently the php_gtk extension
imports the locale settings from Windows, but also changes something in the PHP engine to not accept
"." as a decimal point in source code anymore.
Tested with php-gtk 1.0.1a and php 4.3.9-dev
It seems to be fixed when using php-gtk 1.0.2 and php 4.4.1-dev
----
Server IP: 217.13.201.10
Probable Submitter: 129.233.113.134
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.setlocale.php
Edit -- http://master.php.net/note/edit/65240
Del: integrated -- http://master.php.net/note/delete/65240/integrated
Del: useless -- http://master.php.net/note/delete/65240/useless
Del: bad code -- http://master.php.net/note/delete/65240/bad+code
Del: spam -- http://master.php.net/note/delete/65240/spam
Del: non-english -- http://master.php.net/note/delete/65240/non-english
Del: in docs -- http://master.php.net/note/delete/65240/in+docs
Del: other reasons-- http://master.php.net/note/delete/65240
Reject -- http://master.php.net/note/reject/65240
Search -- http://master.php.net/manage/user-notes.php