Re: For Loops !

From: Date: Mon, 31 Jul 2000 21:30:36 +0000
Subject: Re: For Loops !
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-9284@lists.php.net to get a copy of this message
On Mon, 31 Jul 2000, TomHenry wrote: > I think of it this way > > for ($var=0;$var<10;$var++) { //some code stuff here } > > is shorthand for > > $var=0; > if($var<10){ > > //some code stuff here > > $var++; > } The two are not the same. The for loop will first set $var to 0 and repeat, incrementing $var by 1, until $var < 10. The if check will set $var to 0, run the code if 0 < 10, increment $var by 1, and finish. Matt

« previous php.general (#9284) next »