number_format() 函数通过千位分组来格式化数字。
<?php
$num = 4999.9;
$formattedNum = number_format($num)."
";
echo $formattedNum;
$formattedNum = number_format($num, 2);
echo $formattedNum;
?>
5,000
4,999.90
number_format() 函数通过千位分组来格式化数字。
<?php
$num = 4999.9;
$formattedNum = number_format($num)."
";
echo $formattedNum;
$formattedNum = number_format($num, 2);
echo $formattedNum;
?>
5,000
4,999.90