giraffemedia Posted August 29, 2008 Share Posted August 29, 2008 Hello, i'm trying to round a number up from one decimal point to two but i'm not having any success. the number is 27.5 and i'd like to round it up to 27.50. Can I use the round function like so... $agency_discount = round((($bf_ad_rate/100) * $bf_agency_discount) ,2); echo $agency_discount; Regards James Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 29, 2008 Share Posted August 29, 2008 27.5 to 27.50 isn't a round up as far as i know, it is adding precision after the decimal point. You can use number_format(): <?php $nr = '27.5'; echo number_format($nr, 2, '.', ''); ?> Quote Link to comment Share on other sites More sharing options...
giraffemedia Posted August 29, 2008 Author Share Posted August 29, 2008 Brilliant. That's just the ticket GuiltyGear. Thanks James Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.