php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2794 sprintf/printf work as (float) round()
Submitted: 1999-11-22 18:40 UTC Modified: 1999-11-29 18:52 UTC
From: madmax at express dot ru Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.12 OS: FreeBSD 3.0-RELEASE
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: madmax at express dot ru
New email:
PHP Version: OS:

 

 [1999-11-22 18:40 UTC] madmax at express dot ru
<?
 $tst1="1234.5678";
 $tst2="1234.4321";
 $out1=sprintf("%01.2f", $tst1);
 $out2=sprintf("%01.2f", $tst2);
 $out3=sprintf("%01.0f", $tst1);
 $out4=sprintf("%01.0f", $tst2);
 print "$tst1<==>$tst2<br>$out1<==>$out2<br>$out3<==>$out4";
?>


output was:
1234.5678<==>1234.4321
1234.57<==>1234.43
1235<==>1234

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-29 18:52 UTC] joey at cvs dot php dot net
Read docs closer. This is the proper behavior for your OS.
;)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 16:00:02 2026 UTC