If you just want something simple:

'$' . number_format($money, 2);

number_format()

Answer from Darryl Hein on Stack Overflow
🌐
PHP
php.net › manual › en › function.number-format.php
PHP: number_format - Manual
number_format( float $num, int $decimals = 0, ?string $decimal_separator = ".", ?string $thousands_separator = "," ): string
🌐
Webfulcreations
webfulcreations.com › home › blog › php number_format() function – complete guide with examples
PHP number_format() Function – Format Numbers in PHP with Examples
August 30, 2025 - Learn how to use PHP number_format() function to format numbers with decimals, commas, and currency symbols. Explore syntax, parameters, and practical examples for better code readability.
🌐
W3Schools
w3schools.com › php › func_string_number_format.asp
PHP number_format() Function
You want to return a price: One parameter will round the number (it will be formatted without decimals). Two parameters should give the result you want: <?php $num = 1999.9; $formattedNum = number_format($num)."<br>"; echo $formattedNum; $formattedNum = number_format($num, 2); echo $formattedNum; ?> Try it Yourself » ·
🌐
GitHub
gist.github.com › RadGH › 84edff0cc81e6326029c
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t) · GitHub
/** * @param $n * @return string * Use to convert large positive numbers in to short form like 1K+, 100K+, 199K+, 1M+, 10M+, 1B+ etc */ function number_format_short( $n ) { if ($n > 0 && $n < 1000) { // 1 - 999 $n_format = floor($n); $suffix = ''; } else if ($n >= 1000 && $n < 1000000) { // 1k-999k $n_format = floor($n / 1000); $suffix = 'K+'; } else if ($n >= 1000000 && $n < 1000000000) { // 1m-999m $n_format = floor($n / 1000000); $suffix = 'M+'; } else if ($n >= 1000000000 && $n < 1000000000000) { // 1b-999b $n_format = floor($n / 1000000000); $suffix = 'B+'; } else if ($n >= 1000000000000) { // 1t+ $n_format = floor($n / 1000000000000); $suffix = 'T+'; } return !empty($n_format .
🌐
TutorialsPoint
tutorialspoint.com › number-format-function-in-php
number_format() function in PHP
PHPProgrammingServer Side Programming · The number_format() function is used to format a number with grouped thousands. number_format(num,decimals,decimal_pt,separator) num − The number to be formatted. decimals − Specifies how many decimals. decimal_pt − The string to be used for decimal ...
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-number_format-function
PHP number_format() Function - GeeksforGeeks
July 11, 2025 - The number_format() function is an inbuilt function in PHP which is used to format a number with grouped thousands. It returns the formatted number on success otherwise it gives E_WARNING on failure.
🌐
Codecademy
codecademy.com › docs › php › string functions › number_format()
PHP | String Functions | number_format() | Codecademy
September 17, 2023 - This example uses the number_format() function to format a whole number using "," as a decimal separator and "x" as a thousands separator. <?php · echo number_format("1000000",2,",","x"); ?> Copy to clipboard · Copy to clipboard · This will result in the following output: 1x000x000,00 ·
Find elsewhere
🌐
OnlinePHP
onlinephp.io › number-format › manual
number_format - OnlinePHP.io Example
Sets the number of decimal digits. If 0, the decimal_separator is omitted from the return value. ... Sets the separator for the decimal point. ... Sets the thousands separator. A formatted version of num.
🌐
Code.mu
code.mu › en › php › book › prime › inbuilt › string › numbers-formatting
Formatting a Number in PHP
Format the number so that it has thousands separators (space) and two digits in the fractional part:
🌐
CalculatorSoup
calculatorsoup.com › calculators › construction › feetandinches.php
Feet and Inches Calculator | Foot and Inch
Enter feet and inches as whole numbers, fractions, mixed numbers or decimals. See answers in whole numbers, decimals and mixed number fractions. You can use any number format in any entry box.
🌐
Twig
twig.symfony.com › doc › 3.x › filters › number_format.html
number_format - Filters - Documentation - Twig PHP
The number_format filter formats numbers. It is a wrapper around PHP's number_format function:
🌐
Wikipedia
en.wikipedia.org › wiki › Telephone_numbers_in_France
Telephone numbers in France - Wikipedia
February 20, 2026 - Telephone numbers are usually stated as a sequence of five digit-pairs, e.g., 0x xx xx xx xx–and not, for example, 0 xxx-xxx-xxx or others. Overseas departments and collectivities have distinct country codes and different digit grouping formats.
🌐
Ashpotmicrosystems
ashpotmicrosystems.com › articles › 1461547 › formatting-numbers-with-commas-in-php
Formatting numbers with commas in PHP
October 25, 2017 - To keep it simple, we have to note that in its most basic form, number_format() accepts a number to format, and returns a string containing the formatted number, rounded to the nearest whole number, with commas between each group of thousands. Below is a simple PHP code that does this: