On Sat, 22 Aug 2009 14:02:58 +0100, a...@ashleysheridan.co.uk (Ashley Sheridan)
wrote:
>On Sat, 2009-08-22 at 13:00 +0100, Richard Heyes wrote:
>> Hi,
>>
>> > Is there a way to round down to the nearest 50?
>> >
>> > Example: Any number between 400 and 449 I would 400 to be displayed; 450
>> >
Hi,
> ...
A little modification:
= 50 ? '50' : '00'));
}
echo myRound(449) . ''; // 400
echo myRound(450) . ''; // 450
echo myRound(356) . ''; // 350
echo myRound(79) . ''; // 50
?>
PS I haven't checked if there's a PHP function for this.
--
Richard Heyes
HTML5 graphing:
Hi,
> It should be round() and not floor().
>
> 449 / 50 = 8.98
> floor(8.98) = 8
> 8 * 50 = 400
>
> round(8.98) = 9
> 9 * 50 = 450
Not based on the examples given:
> Example: Any number between 400 and 449 I would 400 to be displayed
--
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (u
Ron
>
> - Original Message - From: "Ashley Sheridan" <
> a...@ashleysheridan.co.uk>
> To: "Richard Heyes"
> Cc: "Ron Piggott" ; >
> Sent: Saturday, August 22, 2009 9:02 AM
> Subject: Re: [PHP] Rounding down?
>
>
> On Sat, 2009-08-22
Thanks; Amazing. Ron
- Original Message -
From: "Ashley Sheridan"
To: "Richard Heyes"
Cc: "Ron Piggott" ;
Sent: Saturday, August 22, 2009 9:02 AM
Subject: Re: [PHP] Rounding down?
On Sat, 2009-08-22 at 13:00 +0100, Richard Heyes wrote:
Hi,
> Is
On Sat, 2009-08-22 at 13:00 +0100, Richard Heyes wrote:
> Hi,
>
> > Is there a way to round down to the nearest 50?
> >
> > Example: Any number between 400 and 449 I would 400 to be displayed; 450 to
> > 499 would be 450; 500 to 549 would be 500, etc?
>
> Off the top of my head: divide the numbe
Hi,
> Is there a way to round down to the nearest 50?
>
> Example: Any number between 400 and 449 I would 400 to be displayed; 450 to
> 499 would be 450; 500 to 549 would be 500, etc?
Off the top of my head: divide the number by 50, run floor() on the
result, then times it by 50.
1. 449 / 50 =
Brad Ciszewski wrote:
hi everyone, i am looking for a snipplet to round down a number. i was wondering if you could put a negative number in the round() statement to do this, i want it to round down even if its at something.9, as long as its not a whole number, if needs to be rounded down. can anyo
On November 26, 2004 08:58, Brad Ciszewski wrote:
> hi everyone, i am looking for a snipplet to round down a number. i was
> wondering if you could put a negative number in the round() statement to do
> this, i want it to round down even if its at something.9, as long as its
> not a whole number, i
Brad Ciszewski wrote:
hi everyone, i am looking for a snipplet to round down a number. i was wondering if you could put a negative number in the round() statement to do this, i want it to round down even if its at something.9, as long as its not a whole number, if needs to be rounded down. can anyo
10 matches
Mail list logo