To answer the original question using money_format , it is just
money_format('%.2n', 12345.67);
money_format always starts with % . .2 indicates that you always want to use 2 decimal places. If you pass the integer, it will add .00 to the end. n indicates that you want to use the national format of the national currency.
It is important to note that you must correctly set the locale, since money_format is based on the locale set for LC_MONETARY . To set the locale, use setlocale . In this case, it seems to you that you want en_US .
setlocale(LC_MONETARY, 'en_US.UTF-8');
DriverDan Mar 18 2018-12-18T00: 00Z
source share