besly98 Posted August 2, 2009 Share Posted August 2, 2009 Hi All, Can anyone tell me how to round a number up. E.g this will round down to 3 echo round(3.4); how do i make sure, even if the number is 3.1 or 1.1 etc that it will always round up to the next number and not display any decimel places? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/168502-php-round/ Share on other sites More sharing options...
Dânêl Posted August 2, 2009 Share Posted August 2, 2009 Hi, to have always the next highest integer you have to use ceil() instead of round() Quote Link to comment https://forums.phpfreaks.com/topic/168502-php-round/#findComment-888873 Share on other sites More sharing options...
besly98 Posted August 2, 2009 Author Share Posted August 2, 2009 hanks for that. and how do i always round down? Quote Link to comment https://forums.phpfreaks.com/topic/168502-php-round/#findComment-888914 Share on other sites More sharing options...
Bricktop Posted August 2, 2009 Share Posted August 2, 2009 Hi besly98, Like Dânêl said use ceil() for rounding up, but to round down use floor(). Quote Link to comment https://forums.phpfreaks.com/topic/168502-php-round/#findComment-888916 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.