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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 8 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 04:01:28 2024 UTC