From: hkh at netnords dot dk
Operating system: linux
PHP version: 4.3.4
PHP Bug Type: Feature/Change Request
Bug description: Problem with (float) typecasting
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 bug report at http://bugs.php.net/?id=26992&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26992&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26992&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26992&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26992&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26992&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26992&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26992&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26992&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26992&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26992&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26992&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26992&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26992&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26992&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26992&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26992&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26992&r=float