I want to set two decimal place. I have two numbers, one is 45 and other is 6.5. Now I want to print it like 45.00 and 6.50 I use php. Can any one help me?
My code is given below
<?php
$a=45; $b=6.5;
echo ($a,2); echo ($b,2);
?>
I want to set two decimal place. I have two numbers, one is 45 and other is 6.5. Now I want to print it like 45.00 and 6.50 I use php. Can any one help me?
My code is given below
<?php
$a=45; $b=6.5;
echo ($a,2); echo ($b,2);
?>
Check out the number_format function:
$a = 45;
echo number_format($a, 2);
// prints out "45.00"