<?php
$str = 123465789;
echo number_format($str).'<br>';//output 123,465,789
echo number_format($str, 2);//output 123,465,789.00
?>
$str = 123465789;
echo number_format($str).'<br>';//output 123,465,789
echo number_format($str, 2);//output 123,465,789.00
?>
本文介绍了一种使用PHP内置函数number_format进行数字格式化的简单方法,演示了如何将长数字转换为更易读的格式,并提供了保留两位小数的示例。

275

被折叠的 条评论
为什么被折叠?



