Re: array loops

From: Date: Fri, 01 Dec 2000 10:09:09 +0000
Subject: Re: array loops
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28332@lists.php.net to get a copy of this message
I know Im beeing picky here, but what is $i is 5 ? then it will flip between 5 and 4. A better way is this. <? while (...) { $i = !$i; echo "$i <br>\n"; } ?> Now $i can be anything before you enter the loop and your ok. Chris Lee Mediawaveonline.com In article <4.2.0.58.20001201170650.00a04680@mail.cdbaby.com>, list@hitmedia.com wrote: > At 07:15 AM 12/1/00 , you wrote: >>while(....) >> { >> $i =+ 1; >> >> $i % 2 ? print "color 1" : "color 2"; >> } > > > Another method is: > > $i = 1-$i > > So it just keeps flagging back and forth between 1 and 0. > > >

« previous php.general (#28332) next »