diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-21 16:54:22 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-27 10:42:25 +0200 |
commit | 0221b8b2ab8cd53845a03cedb31add36e58e390f (patch) | |
tree | 8fa2ee16ccf477a0211fac9ad4e86ad9406be974 /sapi/phpdbg/tests/phpdbg_break_next.phpt | |
parent | 2423288f0f6244988e85f35b2e5a4c90a4e557a7 (diff) | |
download | php-git-0221b8b2ab8cd53845a03cedb31add36e58e390f.tar.gz |
Add support for * width and precision in printf()
If * is used for width/precision in printf, then the width/precision
is provided by a printf argument instead of being part of the format
string. Semantics generally match those of printf in C.
This can be used to easily reproduce PHP's float printing behavior:
// Locale-sensitive using precision ini setting.
// Used prior to PHP 8.0.
sprintf("%.*G", (int) ini_get('precision'), $float);
// Locale-insensitive using precision ini setting.
// Used since to PHP 8.0.
sprintf("%.*H", (int) ini_get('precision'), $float);
// Locale-insensitive using serialize_precision ini setting.
// Used in serialize(), json_encode() etc.
sprintf("%.*H", (int) ini_get('serialize_precision'), $float);
Closes GH-5432.
Diffstat (limited to 'sapi/phpdbg/tests/phpdbg_break_next.phpt')
0 files changed, 0 insertions, 0 deletions