I have a number like this 18914439.4524345860
and I want to display that number like this 18.91
I have try the number_format function
$x = 18914439.4524345860;
echo number_format($x, 2, ".", ".");
and the result is
18.914.439.45
how to show the number like this 18.91
?
Thanks for your attention...
hope this help you :
$int = 18914439.4524345860/1000000;
echo round($int,2);
/* Output 18.91*/
18914439.4524345860
is a complete different number than 18.91
, not just another representation.
You could divide by 1000000
first, and then use number_format
:
$x = 18914439.4524345860;
echo number_format($x / 1000000, 2, ".", ".");