Click to See Complete Forum and Search --> : Decimal places


k0r54
10-25-2005, 12:19 PM
Hi,

Is there a function so i can make $a = 0.64589 into a 3 decimal place number?

Thanks
Adam

chazzy
10-25-2005, 12:58 PM
$a=round(.64589,3);

k0r54
10-25-2005, 01:09 PM
ahh round :)

Thank you :)

k0r54
06-19-2006, 03:41 PM
just a further question to this one.

If the number is 10 how can i make it 10.00?

Thanks

NogDog
06-19-2006, 04:01 PM
$value = 10;
echo number_format ($value, 2);
// ...or...
printf("%.2d", $value);