#21648 [Opn->Fbk]: number_format() output error
ID: 21648
Updated by: sniper@php.net
Reported By: bubak@cpan.cz
-Status: Open
+Status: Feedback
Bug Type: *Math Functions
Operating System: RedHat 7.3
PHP Version: 4.3.0
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2003-01-15 01:58:50] bubak@cpan.cz
There is problem with output from function number_format()
I have compiled PHP 4.3.0 as Apache module.
print number_format($number,2,"."," ");
if $number is in range 100000 - 999999 or 100000000 - 999999999, output
has random character at the begining.
example:
<?
$number=850000000.90;
$number_f=number_format($number,2,"."," ");
for ($i=0;$i<strlen($number_f);$i++) {
print ord($number_f[$i])." --> ".$number_f[$i]."<br />";
}
print $number_f;
?>
produced:
114 --> r
56 --> 8
53 --> 5
48 --> 0
32 -->
48 --> 0
48 --> 0
48 --> 0
32 -->
48 --> 0
48 --> 0
48 --> 0
46 --> .
57 --> 9
48 --> 0
r850 000 000.90
next run of script add this at the beginning:
72 --> H
Thank you for your help.
Regards Milan
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21648&edit=1
Thread (4 messages)