Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Round up to nearest 5

Posted on 2009-02-09
3
Medium Priority
?
1,024 Views
Last Modified: 2012-05-06
Hi there,

Wondered if there was a PHP that will round up a value to the nearest 5; it always has to round up and not down e.g 381 would be 385.
0
Comment
Question by:wellso
3 Comments
 
LVL 10

Accepted Solution

by:
pvginkel earned 2000 total points
ID: 23589143
Try the following:
$var = 7;
 
echo ceil($var / 5) * 5;

Open in new window

0
 
LVL 2

Author Closing Comment

by:wellso
ID: 31544451
Thanks bud, its all so simple now :-)
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 34907768
And today, I didn't have to work this out for myself.

Thanks pvginkel.

And to wellso for the question.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question