HaLo2FrEeEk Posted August 20, 2007 Share Posted August 20, 2007 Hey, if the title didn't make any sense, I need a function that will round up to the next ten, meaning that 6 => 10, 14 => 20, 31 => 40, if anyone can help me with this, it would be very appreciated, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/65788-solved-round-up-to-the-next-ten/ Share on other sites More sharing options...
AndyB Posted August 20, 2007 Share Posted August 20, 2007 <?php $num = 17; $rounded = 10 * ceil(0.1*$num); echo $rounded; // 20 ?> I'll leave it to you to create the function Quote Link to comment https://forums.phpfreaks.com/topic/65788-solved-round-up-to-the-next-ten/#findComment-328682 Share on other sites More sharing options...
HaLo2FrEeEk Posted August 20, 2007 Author Share Posted August 20, 2007 You're a genius, thank you, I would never have thought of doing it like that. Quote Link to comment https://forums.phpfreaks.com/topic/65788-solved-round-up-to-the-next-ten/#findComment-328686 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.