Saturday, 28 September 2013

PHP code to round decimals up

PHP code to round decimals up

I am using
$p1 = 66.97;
$price1 = $row['Value']*$p1;
$price1 = number_format($price1, 2, '.', '');
To do a simple calculation and then show the price to 2 decimal places.
this works fine. I would like to round the result up to the nearest .05.
So 18.93 would be 18.95, 19.57 would be 19.60 etc. Any ideas on this - I
am struggling. Thanks.

No comments:

Post a Comment