Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
具有以下十进制数:
我想知道,如何.00为那些没有小数的数字添加默认值?
.00
你可以number_format()这样使用:
number_format()
number_format($number, 2);
它总是返回带两位小数的数字。它还将用“,”分隔数千个(如果您不希望这样做,请添加“”作为第四个参数)。