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. 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 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. 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
Archived
This topic is now archived and is closed to further replies.