Bug #10537 Updated: number_format ing variables breaks totals
| From: | derick@php.net | Date: | Sat, 28 Apr 2001 16:16:42 +0000 |
| Subject: | Bug #10537 Updated: number_format ing variables breaks totals | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52715@lists.php.net to get a copy of this message | ||
ID: 10537
Updated by: derick
Reported By: mguertin@macdiscussion.com
Old-Status: Open
Status: Bogus
Bug Type: *Function Specific
PHP Version: 4.0.4pl1
Assigned To:
Comments:
This is not a bug, after the first number_format in the second piece, $value is a string.
When adding strings, the variabele gets converted back to a integer or float, but uonly until the
first character that is not in the set [0-9] or .
Previous Comments:
---------------------------------------------------------------------------
[2001-04-28 12:07:29] mguertin@macdiscussion.com
I finally got some time to write some code to show this...I
may be wrong in assuming the behaviour, but either way the
totals are definately wrong. Here's the snippet:
$value = 1234;
$total = $value + $value;
print number_format($value,2) . " + " .
number_format($value,2) . " = " . number_format($total,2);
print "<BR><BR>";
$value = number_format($value,2);
$total = $value + $value;
print $value . " + " . $value . " = " . $total;
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10537&edit=2