#9834 [Com]: Unable to handle double variables
| From: | robin dot avery at nospamforme dot com | Date: | Tue, 03 Aug 2004 22:52:17 +0000 |
| Subject: | #9834 [Com]: Unable to handle double variables | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64046@lists.php.net to get a copy of this message | ||
ID: 9834
Comment by: robin dot avery at nospamforme dot com
Reported By: jan dot wurl at prosales-europe dot com
Status: Closed
Bug Type: Math related
Operating System: Windows 2000
PHP Version: 4.0.4pl1
New Comment:
try this:
$a=2\.54;
$b="2\.54"
the forward slashes show that "." is not special.
Previous Comments:
------------------------------------------------------------------------
[2001-04-19 09:33:39] sniper@php.net
No feedback.
--Jani
------------------------------------------------------------------------
[2001-03-19 11:49:07] sniper@php.net
Works for me just fine. But I think it's some locale
thingie. You might have ',' as the decimal separator.
Try setting the locale correctly:
setlocale(LC_NUMERIC, "en_US");
or something like that. Or you ',' as the separator.
--Jani
------------------------------------------------------------------------
[2001-03-19 06:11:28] jan dot wurl at prosales-europe dot com
I try to set a variable with a double value:
$a=2.54;
$b="2.54"
but PHP ignores everything after the point
echo ($a*100) results 200
echo ($b*100) results 200
I tried everything, i thought it might be work (like setting datatype
before set the value, ...), but nothing worked.
Jan Wurl
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=9834&edit=1