php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60755 "*" modifier for sprintf
Submitted: 2012-01-14 18:34 UTC Modified: 2020-05-27 10:23 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dohardgopro at gmail dot com Assigned: nikic (profile)
Status: Closed Package: SPL related
PHP Version: Irrelevant OS: *
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: dohardgopro at gmail dot com
New email:
PHP Version: OS:

 

 [2012-01-14 18:34 UTC] dohardgopro at gmail dot com
Description:
------------
Hi all, I'v add support of "*" modifier for sprintf, it exist in sprintf C 
implementation (http://www.cplusplus.com/reference/clibrary/cstdio/printf/)

My patch attached

Test script:
---------------
sprintf("%.*f", 2, 2) // output "2.00"
sprintf("%.2f", 2) // output "2.00"


Patches

formatted_print (last revision 2012-01-14 18:35 UTC by dohardgopro at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-21 16:35 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2020-05-27 10:23 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 [2020-05-27 10:23 UTC] nikic@php.net
Support for * has been added in PHP 8.0: https://github.com/php/php-src/commit/0221b8b2ab8cd53845a03cedb31add36e58e390f
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 02:01:35 2025 UTC