# [PATCH] sprintf like functions and "*" modifier

- Thread: https://externals.io/message/57349
- Original archive: https://news-web.php.net/php.internals/57349
- Started by Azat Khuzhin on 2012-01-13T13:10:47+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #57349 — Azat Khuzhin — 2012-01-13T13:10:47+00:00

URL: https://externals.io/message/57349#57349

Hi all, I'v add support of "*" modifier for sprintf, it exist in sprintf C
implementation (http://www.cplusplus.com/reference/clibrary/cstdio/printf/)

Usage:
sprintf("%.*f", 2, 2) // output "2.00"
sprintf("%.2f", 2) // output "2.00"

My patch attached

-- 
Azat Khuzhin

---

## #57361 — Christopher Jones — 2012-01-13T19:01:30+00:00

URL: https://externals.io/message/57349#57361 · In reply to: #57349

> Hi all, I'v add support of "*" modifier for sprintf, it exist in sprintf C implementation (http://www.cplusplus.com/reference/clibrary/cstdio/printf/)
>
> Usage:
> sprintf("%.*f", 2, 2) // output "2.00"
> sprintf("%.2f", 2) // output "2.00"
>
> My patch attached


For tracking, can you log a bug and attach the patch (and any relevant tests)?

Chris

-- 
Email: christopher.jones@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/
