RE: [PHP] Re: PHP Math Question
| From: | Bronislav Klučka | Date: | Thu, 11 Dec 2003 23:22:34 +0000 |
| Subject: | RE: [PHP] Re: PHP Math Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172538@lists.php.net to get a copy of this message | ||
I do not know if I understand well, but what about
$group=$number % 4;
if ($group==0) $group=4;
Brona
> -----Original Message-----
> From: Eric Bolikowski [mailto:eric@broadpark.no]
> Sent: Thursday, December 11, 2003 10:53 PM
> To: php-general@lists.php.net
> Subject: [PHP] Re: PHP Math Question
>
>
>
> "Mike D" <mike@awn.com> wrote in message
> news:BBFE14A9.107A2%mike@awn.com...
> > I'm am completely stumped on a seemingly simple math formula
> >
> > I need to find a way to map a set of numbers up to 4 (e.g.
> 1,2,3,4 or 1,2)
> > to any number in a range of up to 10,000 (ideally, unlimited).
> Such that,
> >
> > (e.g. 1,2,3,4)
> >
> > 1 is to 1
> > 2 is to 2
> > 3 is to 3
> > 4 is to 4
> >
> > 5 is to 1
> > 6 is to 2
> > 7 is to 3
> > 8 is to 4
> >
> > 9 is to 1
> > 10 is to 2
> > 11 is to 3
> > 12 is to 4
> >
> > 13 is to 1
> > 14 is to 2
> > 15 is to 3
> > 16 is to 4
> >
> > And so on...
> >
> > Is anyone good at math, that can throw me a bone?
> >
> > Thanks y'all,
> > Mike D
> >
> >
> > ....................................
> > Mike Dunlop
> > AWN, Inc.
> > // www.awn.com
> > [ e ] webmaster@awn.com
> > [ p ] 323.606.4237
>
> Here is some simple code to solve that problem(if i have
> understood right):
>
> <?php
>
> for($i = 1, $j = 1; $i <= 10000; $i++, $j++){
>
> if($j == 5){
> $j = 1;
> print "\n<br>";
> }
>
> print "$i is to $j<br>\n";
>
> }
>
> ?>
>
> Eric
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>