ShoeLace1291 Posted November 1, 2010 Share Posted November 1, 2010 I was wondering if there was a way to round whole numbers in increments. I need to make a progress bar based on percentages and for every ten percent of progress that is made, I want to add a bar. So for example: 38% would display four bars 21% would display two bars 15% would display one bar. Are there any PHP functions like this? Link to comment https://forums.phpfreaks.com/topic/217422-round-whole-numbers-in-increments/ Share on other sites More sharing options...
mikecampbell Posted November 1, 2010 Share Posted November 1, 2010 I think you want the round function passing -1 as the second argument. round(38, -1) = 40 round(21, -1) = 20 round(15, -1) = 20 Then divide by ten to get the number of bars. Link to comment https://forums.phpfreaks.com/topic/217422-round-whole-numbers-in-increments/#findComment-1128878 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.