Solved

Round DOWN to nearest 50000 ?

Posted on 2006-07-18
2
671 Views
Last Modified: 2013-12-12
Hi all

I need to be able to round down a number to the nearest 50000 ...any ideas on how to do this? Are there any existing php functions that can handle this? It's a bit beyond the round() functions isn't it?

Example 1:
$input = 35001;
$output needs to be 350000;

Example 2:
$input = 34999;
$output needs to be 300000;

Cheers,
Mark
0
Comment
Question by:msiedle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 500 total points
ID: 17135501
If you are rounding down - you can just subtract the remainder from a modular division

ie
$roundFigure = 5000;
$input = 35001;

$output = $input - fmod ($input, $roundFigure;

Which should give

35000
0
 
LVL 2

Author Comment

by:msiedle
ID: 17135554
Beautiful! Thank you :-)

M
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

734 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