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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 08:01:30 2025 UTC