I would like to make dots between my total value.
If i have 425000 i would like it to show as 425.000
Is there a function in php that implodes dots for numbers o
Use number_format for this:
$number = 425000;
echo number_format( $number, 0, '', '.' );
The above example means: format the number, using 0
decimal places, an empty string as the decimal point (as we're not using decimal places anyway), and use .
as the thousands separator.
Unless of course I misunderstood your intent, and you want to format the number as a number with 3 decimal places:
$number = 425000;
echo number_format( $number, 3, '.', '' );
The above example means: format the number, using 3
decimal places, .
as the decimal point (default), and an empty string as the thousands separator (defaults to ,
).
If the default thousands separator is good enough for you, you can just use 1:
$number = 425000;
echo number_format( $number, 3 );
number_format
accepts either 1, 2 or 4 parameters, not 3.
I guess you're looking for the number_format function.