Re: Numeric help needed

From: Date: Mon, 16 Jan 2012 02:00:15 +0000
Subject: Re: Numeric help needed
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-316304@lists.php.net to get a copy of this message
On 1/15/2012 8: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 On Sun, Jan 15, 2012 at 8:41 PM, Jason Pruim<lists@pruimphotography.com> wrote:
Sent from my iPhone On Jan 15, 2012, at 8:25 PM, "Christopher J Payne"<oxygenet32@gmail.com> wrote:
Hi everyone, I am having a hard time with a numerical problem. I need to round some numbers up and I've tried $round($number) and it doesn't work so I'm misunderstanding something. For example, if a user inputs 685000 I need it to round up to 690000 or if they input 149560 I need it to round up to 150000. What is the correct way to do this as everything I have tried doesn't seem to affect the user inputted figure at all. Anyway help would REALLY be appreciated, I'm sure it's really simple but for the life of me I'm stumped on why it's not working.
Maybe it's just a typo in your email but you put a $ infront of round() try removing that and see if it helps. If not are there any error messages that are showing up? http://php.net/manual/en/function.round.php
From the page: |<?php echo round(3.4); // 3 echo round(3.5); // 4 echo round(3.6); // 4 echo round(3.6, 0); // 4 echo round(1.95583, 2); // 1.96 echo round(1241757, -3); // 1242000 echo round(5.045, 2); // 5.05 echo round(5.055, 2); // 5.06 ?> |

« previous php.general (#316304) next »