Hi Erik,
> I have a foreach loop, where I execute some
> commands for each element in a certain array.
> One thing I would like to add to this loop is a
> counter, so that on each iteration of the loop
> I have a next higher number. The following does
> not work:
>
> foreach ($months) {
>
On Tue, 26 Mar 2002, Erik Price wrote:
> I have a pretty basic question and was wondering if someone could point
> me in the right direction:
>
> I have a foreach loop, where I execute some commands for each element in
> a certain array. One thing I would like to add to this loop is a
> coun
What an embarrassing oversight. I'm sorry, I figured this one out. You
don't define the $i counter variable in the loop (DUH).
$i = 1;
foreach ($months) {
// do some things
$i++;
}
Thanks to all those who may respond before reading this
Erik
On Tuesday, March 26, 2002, at 09:49
$i = 1;
foreach ($months) {
// do some things
$i++;
}
> -Original Message-
> From: Erik Price [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 26, 2002 9:49 AM
>
> I have a foreach loop, where I execute some commands for each
> element in
> a certain array. One thing I would l
4 matches
Mail list logo