#29538 [Ver->Fbk]: number_format and problem with 0

From: Date: Wed, 19 Jan 2005 17:25:14 +0000
Subject: #29538 [Ver->Fbk]: number_format and problem with 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-72472@lists.php.net to get a copy of this message
ID: 29538 Updated by: iliaa@php.net Reported By: maugeri at tiscali dot it -Status: Verified +Status: Feedback Bug Type: Math related Operating System: Linux Fedora Core 2 PHP Version: 4CVS, 5CVS (2004-12-12) Previous Comments: ------------------------------------------------------------------------ [2004-12-14 01:29:11] iliaa@php.net With what version did it work "correctly" I tested 4.3.7, 4.3.8, 4.3.9 and 4.3.10RCs and they all don't have a leading 0. ------------------------------------------------------------------------ [2004-08-05 17:16:47] maugeri at tiscali dot it 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 this bug report at http://bugs.php.net/?id=29538&edit=1

« previous php.bugs (#72472) next »