How do you convert a number to a string showing dollars and cents?
eg: 123.45 => '$123.45' 123.456 => '$123.46' 123 => '$123.00' .13 => '$0.13' .1 => '$0.10' 0 => '$0.00'
If you just want something simple:
'$' . number_format($money, 2);
number_format()
2.1m questions
2.1m answers
60 comments
57.0k users