-1

I have something like this:

$exp = 1555678;

if i put $exp inside number_format() the out come will be like:

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

and if i put them inside round() function will be like:

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

but i need something like 1,556,000

whatever the exp is, it's should round() only 3 number behind first comma

Or there is another way to work with this case?

1 Answers1

1

You can combine both approaches

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

which gives: 1,556,000

Dale
  • 10,384
  • 21
  • 34