1
0
mirror of https://github.com/php/php-src.git synced 2026-04-02 13:43:02 +02:00
Files
archived-php-src/ext/standard
Nikita Popov 0221b8b2ab 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.
2020-05-27 10:42:25 +02:00
..
2020-05-13 17:24:13 +02:00
2020-04-06 10:41:01 +02:00
2020-05-14 09:39:03 +02:00
2020-05-14 13:35:12 +02:00
2020-05-14 13:35:12 +02:00
2020-05-14 13:35:12 +02:00
2020-05-04 23:02:00 +02:00
2020-05-04 23:02:00 +02:00
2020-04-13 21:09:23 -07:00
2020-01-28 15:37:51 +01:00
2020-02-24 10:20:49 +01:00
2020-02-25 10:21:31 +01:00
2020-05-14 10:25:52 +02:00
2020-05-13 14:56:05 +02:00
2020-05-09 12:28:49 +08:00