【问题标题】:How from number_format function I can remove the cents part in PHP如何从 number_format 函数中删除 PHP 中的美分部分
【发布时间】:2020-06-26 03:20:29
【问题描述】:

从此代码:

$total = 750;
number_format($total, 2, ',', ' ').'<sup>$</sup>';

我收到750,00$

如何删除,00 部分?

谢谢。

【问题讨论】:

标签: php number-formatting


【解决方案1】:

要从结果中删除,00。您必须将代码更改为

$total = 750;
number_format($total, 0, ',', ' ').'<sup>$</sup>';

【讨论】:

    猜你喜欢
    • 2012-03-08
    • 2014-04-15
    • 2014-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-18
    相关资源
    最近更新 更多