Re: Here's my rounding
| From: | Simon J Welsh | Date: | Fri, 28 Sep 2012 06:11:05 +0000 |
| Subject: | Re: Here's my rounding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319293@lists.php.net to get a copy of this message | ||
On 28/09/2012, at 6:08 PM, Chris Payne <oxygenet32@gmail.com> wrote:
> $test2 = '253177';
> echo $tes2 . " rounded to: ";
> $rounded_number = round($test2,-3);
> echo $rounded_number;
>
> Is it SUPPOSED to happy a number is sent to this little system and it's
> SUPPOSED to round the number up. So if the number was 144035 the system
> should look at it and say "Hey uo,
> we need to round this up" So basicially I need it to convert in
> thousands. Even if the total is a fraction over it still needs to ne
> calculated as the next thousand up.
>
> Sprru of o'm confusing you, i'm very tired. So basically, just make the
> last 4 numbers always round up. 255000 would be correct - 255590 would
> beINSORERECT as it should display 255600.
>
> Hope that helped someone to help me :-)
>
> xxx
> Chris
I would use something similar to $rounded_number = ceil($test2/1000)*1000;
---
Simon Welsh
Admin of http://simon.geek.nz/