From ae148826a6830492a51e47f21e1ad4f80373f2a6 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Sun, 1 Dec 2024 11:38:35 -0800 Subject: [PATCH] Document number_format() handling of negative $decimals (closes #4200) (#4201) Co-authored-by: Gina Peter Banyard --- reference/strings/functions/number-format.xml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/reference/strings/functions/number-format.xml b/reference/strings/functions/number-format.xml index ee6c19be0eab..5220842b2ca2 100644 --- a/reference/strings/functions/number-format.xml +++ b/reference/strings/functions/number-format.xml @@ -39,6 +39,11 @@ Sets the number of decimal digits. If 0, the decimal_separator is omitted from the return value. + As of PHP 8.3.0, when the value is negative, num + is rounded to decimals significant digits before + the decimal point. + Prior to PHP 8.3.0, negative values were ignored and handled the + same as 0. @@ -81,6 +86,12 @@ + + 8.3.0 + + Added handling of negative values for decimals. + + 8.0.0 @@ -137,6 +148,32 @@ $english_format_number = number_format($number, 2, '.', ''); + + A negative value for <parameter>decimals</parameter> + + As of PHP 8.3.0, a negative value for decimals + is used to round the number of significant digits before the decimal + point. + + + +]]> + + &example.outputs; + + + +