Re: Loop within Loop help please
| From: | Eduardo Sampaio | Date: | Tue, 28 Sep 2004 19:22:18 +0000 |
| Subject: | Re: Loop within Loop help please | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198110@lists.php.net to get a copy of this message | ||
You missed the $count = 0;
right below it Andrew... his code works just like the modulus one...
On Tue, 28 Sep 2004 12:10:21 -0700, Andrew Kreps <andrew.kreps@gmail.com> wrote:
> On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson <jdavidson@zworg.com> wrote:
> > I see lots of references to modulus, which works fantastic.. but how
> > abut just testing if its equal to 20, then there isnt that extra
> > arthmitc call.. this is just another way to do the same thing.. take
> > your pick.. unless someone can see a bad reason for this method.
> >
> > $count = 0;
> > foreach ..... {
> > if($count == 20) {
> > .............
>
> The only thing wrong with this method is that it doesn't fit the
> problem's specifications. The original poster wanted a way to
> trigger the code every 20 iterations of an unknown sized loop
> (implying that the loop would have 40 or more items), whereas the
> solution above only triggers it on iteration 20. Other than that,
> it's a perfectly wonderful piece of code.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>