$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 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) { > $i = 1; > // do some things > $i++; > } > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php