I try to use php number_format to show number like this xxx,xxx,xx.xx .
When I echo value it auto increment from 9999999 to 10000000.
Anyone has idea how to show data result 9,999,999?
<?php echo number_format(99999999,2); ?>
I try to use php number_format to show number like this xxx,xxx,xx.xx .
When I echo value it auto increment from 9999999 to 10000000.
Anyone has idea how to show data result 9,999,999?
<?php echo number_format(99999999,2); ?>
String number_format ( float $number , int $decimals = 0 , string $dec_point = "." , string $thousands_sep = "," )
So, with your example:
<?php echo number_format(9999999, 2, '.', ','); ?>
Outputs:
9,999,999.00
Or if you did not want the decimals:
<?php echo number_format(9999999, 0, '.', ','); ?>
Outputs:
9,999,999
From php.net:
This function accepts either one, two, or four parameters (not three)
Just a reminder.