在number_format()

时间:2018-02-15 11:52:03

标签: php

我有这样的事情:

$exp = 1555678;

如果我把$ exp放在number_format()里面,那就出现了:

   echo number_format($exp);//1,555,678

如果我把它们放在round()函数中就像是:

   echo round(number_format($exp));//1

但我需要1,556,000

之类的东西
  

无论exp是什么,它都应该在第一个逗号后面只有3个数字

     

或者还有另一种方法可以解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您可以将两种方法结合起来

$exp = 1555678;
echo number_format(round($exp, -3));

给出:1,556,000

相关问题