【发布时间】:2016-10-06 09:10:28
【问题描述】:
我从我的查询中返回这个号码:44397.6345
我想以这种格式显示它:44.4
【问题讨论】:
-
除以一千然后用
round()? -
要是有某种搜索引擎就好了....
标签: php decimal rounding number-formatting
我从我的查询中返回这个号码:44397.6345
我想以这种格式显示它:44.4
【问题讨论】:
round()?
标签: php decimal rounding number-formatting
【讨论】:
试试这个,
$number = 1000;
echo number_format((float)$number, 1, '.', '');// 1000.0
$number = 44397.6345;
echo number_format((float)$number, 1, '.', '');// 44397.6
注意:输出为字符串。
【讨论】: