php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30176 decimal printf output - padding error
Submitted: 2004-09-21 03:06 UTC Modified: 2004-09-21 04:44 UTC
From: leroy at twisp-e dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.8 OS: w2k
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leroy at twisp-e dot com
New email:
PHP Version: OS:

 

 [2004-09-21 03:06 UTC] leroy at twisp-e dot com
Description:
------------
Is this a bug? PHP 4.3.8

printf("%07d",  $value)  produces "00value7"
e.g., if $value=123 , output is "00001237"

I expected "00value"


printf("%06d",  $value)  produces "0value6"
I expected "0value"

Am i missing something here?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-21 04:44 UTC] leroy at twisp-e dot com
I figured out the problem. I was echoing the output of printf.

using 

echo printf("%07d",$value) gives 00value7

using 

printf("%07d",$value)gives 00value


Sorry.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 20:01:29 2024 UTC