php数字格式值为999999,但输出显示为10000000


php number format value 999999 but output show 10000000

我尝试使用php number_format来显示类似xxx、xxx、xx.xx的数字。

当我回显值时,它会从9999999自动递增到10000000。

有人知道如何显示数据结果9999999吗?

<?php echo number_format(99999999,2); ?>

String number_format ( float $number , int $decimals = 0 , string $dec_point = "." , string $thousands_sep = "," )

所以,以你的例子:

<?php echo number_format(9999999, 2, '.', ','); ?>

输出:

9,999,999.00

或者如果你不想要小数:

<?php echo number_format(9999999, 0, '.', ','); ?>

输出:

9,999,999

来自php.net:

This function accepts either one, two, or four parameters (not three)

只是一个提醒。