在PHP中如何将数字格式化为货币

如何将数字转换为显示美元和美分的字符串?

eg:
123.45    => '$123.45'
123.456   => '$123.46'
123       => '$123.00'
.13       => '$0.13'
.1        => '$0.10'
0         => '$0.00'

5个回答