Re: [PHP] Loop within Loop help please

2004-09-28 Thread Andrew Kreps
On Tue, 28 Sep 2004 16:22:18 -0300, Eduardo Sampaio <[EMAIL PROTECTED]> wrote: > You missed the $count = 0; > right below it Andrew... his code works just like the modulus one... Whoops, my mistake. I write code, really I do. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

RE: [PHP] Loop within Loop help please

2004-09-28 Thread Jason Davidson
Well, elegance, is in the eye of the beholder !!.. but ya, i certainly wasnt contesting the modulas solutiion, ive used mod in similar cases myself, i was just adding some variety. Jason "Jay Blanchard" <[EMAIL PROTECTED]> wrote: > > [snip] > well, actually, the code resets the count var, so it

Re: [PHP] Loop within Loop help please

2004-09-28 Thread John Nichel
Jay Blanchard wrote: [snip] 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. [/snip] That is quite true, but which is more elegant? Whichever way Martha Stewart wo

RE: [PHP] Loop within Loop help please

2004-09-28 Thread Jay Blanchard
[snip] 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. [/snip] That is quite true, but which is more elegant? -- PHP General Mailing List (http://www.php.net/) T

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Jason Davidson
Hey, im sorry, i didnt read the other responses to your post, ive posted the same thing... Jason "Jason Davidson" <[EMAIL PROTECTED]> wrote: > > well, actually, the code resets the count var, so it makes absolutely no > difference how many iterations the loop makes, it could iterated > indefin

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Jason Davidson
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 PRO

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Eduardo Sampaio
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 <[EMAIL PROTECTED]> wrote: > On Tue, 28 Sep 2004 10:45:19 -0700, Jason Davidson <[EMAIL PROTECTED]> wrote: > > I see lots of references to modulus, whic

Re: [PHP] Loop within Loop help please

2004-09-28 Thread John Nichel
Andrew Kreps 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.. tak

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Andrew Kreps
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.

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Nick Wilson
* and then Jason Davidson declared > 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

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Nick Wilson
* and then Jesse Castro declared > [snip] > $count=0; > foreach($someArray as $someVal) { > if($count is divisible by 20 exactly) { > // do some stuff > } > //do some stuff > } > ?> > [/snip] > > if($count is divisible by 20 exactly) > Can be written as > If ($count

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Jason Davidson
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 . {

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Janet Valade
Nick Wilson wrote: hi everyone, I have a simplified bit of code below: What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: How might i do that? if($count % 20 == 0 ) { Janet -- Janet Valade -- janet.valade.com --

RE: [PHP] Loop within Loop help please

2004-09-28 Thread Justin Palmer
How might i do that? Something like that. Justin Much thanks... -- Nick W -- 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

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Nick Wilson
* and then Marek Kilimajer declared > % operator: http://www.php.net/operators Thanks EVERYONE, i feel like i should have known that, but i didnt, my thanks! - and the guy that suggested the other way? that was how i was trying to do it ;-) -- Nick W -- PHP General Mailing List (http://w

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Nick Wilson
* and then Pablo Gosse declared > if ($count%20 == 0) > > http://ca3.php.net/manual/en/language.operators.arithmetic.php in the > manual (look for Modulus). Yes, thankyou very much, got a bunch of similar replys in my personal inbox to ;-) And there was me sifting through the math functions!

RE: [PHP] Loop within Loop help please

2004-09-28 Thread Jay Blanchard
[snip] What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: How might i do that? [/snip] With modulus ...http://us2.php.net/manual/en/language.operators.arithmetic.php -- PHP General Mailing List (http://www.php.net/

Re: [PHP] Loop within Loop help please

2004-09-28 Thread Marek Kilimajer
% operator: http://www.php.net/operators Nick Wilson wrote: hi everyone, I have a simplified bit of code below: What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: How might i do that? Much thanks... -- PHP General Ma

RE: [PHP] Loop within Loop help please

2004-09-28 Thread Pablo Gosse
[snip] I have a simplified bit of code below: What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: [/snip] if ($count%20 == 0) http://ca3.php.net/manual/en/language.operators.arithmetic.php in the manual (look for Mod

Re: [PHP] Loop within Loop help please

2004-09-28 Thread John Nichel
Nick Wilson wrote: hi everyone, I have a simplified bit of code below: What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: How might i do that? Much thanks... $count = 0; foreach ( $someArray as $someVal ) { i

[PHP] Loop within Loop help please

2004-09-28 Thread Nick Wilson
hi everyone, I have a simplified bit of code below: What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: How might i do that? Much thanks... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscr