#26992 [Opn]: Problem with (float) typecasting
| From: | hkh at netnords dot dk | Date: | Wed, 21 Jan 2004 14:35:39 +0000 |
| Subject: | #26992 [Opn]: Problem with (float) typecasting | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-53698@lists.php.net to get a copy of this message | ||
ID: 26992
User updated by: hkh at netnords dot dk
Reported By: hkh at netnords dot dk
Status: Open
Bug Type: Feature/Change Request
Operating System: linux
PHP Version: 4.3.4
New Comment:
I just took a look at
http://dk2.php.net/manual/en/language.types.float.php#language.types.float.casting
As far as I can see, commas are not a legal character in a float.
Previous Comments:
------------------------------------------------------------------------
[2004-01-21 09:23:26] hkh at netnords dot dk
Description:
------------
When using (float)$dd for typecasting a string to a float, I get a
wrong result back, because PHP convert . to ,
Later using the result outside PHP troubles begin.
Thinks it happens because we have used setLocale('da_DK'), because we i
Denmark use , instead of .
Why just use . everytime, as in other programming-languages ?
Reproduce code:
---------------
print ((float)'1.5').'<br>'; // Result 1,5
print ((float)'1,5').'<br>'; // Result 1 - Fine with me
Expected result:
----------------
1.5
1
Actual result:
--------------
1,5
1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26992&edit=1