note 126944 added to function.number-format
| From: | xmontero at dsitelecom dot com | Date: | Sun, 20 Mar 2022 13:57:41 +0000 |
| Subject: | note 126944 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217748@lists.php.net to get a copy of this message | ||
You can use:
number_format( $number, '.', ' ' )
Rationale:
Since 2003, the Internationa Standard of Units regulated that groups of three are to be separated by
spaces and not dots or commas:
We can read about the S.I. in wikipedia about the numbers:
"Spaces should be used as a thousands separator (1000000) in contrast to commas or periods
(1,000,000 or 1.000.000) to reduce confusion resulting from the variation between these forms in
different countries."
here https://en.wikipedia.org/wiki/International_System_of_Units
in the section "General Rules".
More specifically in an official document they introduce the concept of "thin space":
"for numbers with many digits the digits may be divided into groups of three by a thin space,
in order to facilitate reading. Neither dots nor commas are inserted in the spaces between groups of
three."
here https://mcyt.educa.madrid.org/laboratorios/Documentos/Otros/documentos/si_brochure_8_en.pdf
in page 41, in the section "5.3.4 Formatting numbers, and the decimal marker".
Finally, also in wikipedia, we can read about the separation of digits:
"It is also used in the International System of Units and in many countries as a thousands
separator when writing numbers in groups of three digits, in order to facilitate reading."
here: https://en.wikipedia.org/wiki/Thin_space
Note that "THIN SPACE" is breakable and for a non-breakable space we also have the
"NARROW NO-BREAK SPACE". Nevertheless the definition is a bit different:
"Also starting from release 34 of Unicode Common Locale Data Repository (CLDR) the NNBSP is
used in numbers as thousands group separator for French and Spanish locale."
We can read it here: https://en.wikipedia.org/wiki/Non-breaking_space
at the end of the article
So, conclusion: We can use   for the regular one or   for the non-breaking one
in the number_format function to accomodate modern times and forget once and for all to use dots or
commas for the thousands.
More literature:
* Archive of the PDF https://web.archive.org/web/20140705194729/http://www.bipm.org/en/si/si_brochure/chapter5/5-3-2.html
* https://www.bipm.org/en/committees/cg/cgpm/22-2003/resolution-10
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 83.41.208.162)
----
Manual Page -- https://php.net/manual/en/function.number-format.php
Edit -- https://main.php.net/note/edit/126944
Del: integrated -- https://main.php.net/note/delete/126944/integrated
Del: useless -- https://main.php.net/note/delete/126944/useless
Del: bad code -- https://main.php.net/note/delete/126944/bad+code
Del: spam -- https://main.php.net/note/delete/126944/spam
Del: non-english -- https://main.php.net/note/delete/126944/non-english
Del: in docs -- https://main.php.net/note/delete/126944/in+docs
Del: other reasons-- https://main.php.net/note/delete/126944
Reject -- https://main.php.net/note/reject/126944
Search -- https://main.php.net/manage/user-notes.php