Re: Numeric help needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/01/2012, at 2:48 PM, Chris Payne wrote:

> Hi Jason,
> 
> I've tried lots of different things, including:
> 
> echo "<br>" . round(68500, 1000) . " ROUNDED";
> 
> thinking that might be it, but i'm stumped
> 
> This is the example I was given (And have to go by):
> 
> "If the loan amount is $68500.00, the insurace will be based on
> $69000.00 as the amount is always rounded up to the next $1000."
> 
> Maybe i'm just looking at it wrong but i'm stumped.
> 
> Chris


The round() function only rounds decimal values. You can use this to emulate rounding to a near power of ten by dividing, rounding, then multiplying again. i.e. echo "<br>" . round(68500/1000) * 1000 . " ROUNDED";
---
Simon Welsh
Admin of http://simon.geek.nz/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux