well, actually, the code resets the count var, so it makes absolutely no difference how many iterations the loop makes, it could iterated indefinately and still function identically.
Jason Andrew Kreps <[EMAIL PROTECTED]> wrote: > > On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson <[EMAIL PROTECTED]> 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php