number_format
Formats a number with grouped thousands and customizable decimal/thousand separators.
Parameters
main.php
Return Values
string
Returns a formatted version of the number
On success:Formatted number string with specified separators
On failure:Warning if wrong parameter count (cannot use 3 parameters)
Notes
- Accepts 1, 2, or 4 parameters - never 3 parameters
- Returns string, not numeric value - cannot be used for calculations
- Default uses comma (,) for thousands and dot (.) for decimals
- Essential for displaying financial and statistical data
Changelog
- 8.0.0: decimal_separator and thousands_separator are now nullable
Related Functions
date
Date/TimeFormats a local date and time according to the specified format string.
timeformattimestamp