php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21648 number_format() output error
Submitted: 2003-01-15 01:58 UTC Modified: 2003-01-15 09:27 UTC
From: bubak at cpan dot cz Assigned:
Status: Closed Package: *Math Functions
PHP Version: 4.3.0 OS: RedHat 7.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bubak at cpan dot cz
New email:
PHP Version: OS:

 

 [2003-01-15 01:58 UTC] bubak at cpan dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-15 06:04 UTC] bubak at cpan dot cz
I used file "math.c" from version of PHP 4.3.1-dev before change on 9.1.2003.
It seems to work well
 [2003-01-15 09:27 UTC] sniper@php.net
Closing then.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC