From: maugeri at tiscali dot it
Operating system: Linux Fedora Core 2
PHP version: 4.3.8
PHP Bug Type: Scripting Engine problem
Bug description: number_format and problem with 0
Description:
------------
When i try to obtain a value withou the separator give me
a strange result...
$sfero = number_format("0.25", 2, '', '');
echo $sfero;
it give 25 and not 025!!!!!
now i must use
$sfero = number_format("0.25", 2, ',', '');
$sfero = str_replace(",", "", $sfero);
i don't know if is a bug but first,with other php version,
the function number_format worked fine
Reproduce code:
---------------
<?PHP
for($i=1;$i<73;$i++){
$sfero = ($i*0.25);
$sfero = number_format($sfero, 2, '', '');
echo $sfero."<br>";
}
?>
Expected result:
----------------
000
025
050
075
100
125
150
....etc
Actual result:
--------------
25
50
75
100
125
150
....etc
--
Edit bug report at http://bugs.php.net/?id=29538&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29538&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29538&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29538&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29538&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29538&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29538&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29538&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29538&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29538&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29538&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29538&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29538&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29538&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29538&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29538&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29538&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29538&r=float