Re: a for-loop syntax question

From: Date: Mon, 12 Jan 2004 14:11:47 +0000
Subject: Re: a for-loop syntax question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-22557@lists.php.net to get a copy of this message
On Mon, 2004-01-12 at 15:07, Bobo Wieland wrote: > Hi... > > Is there a way to set a for loop to exit when the FIRST of many > expresions evaluate to false? > > the code: for ($i = 0, $j = 0; $i < 10, $j < 5; $i++, $j++) {} will > execute 10 times, but i was hoping it would exit when $j was set to 5... > Is there some way of doing this? > > > .bobo Does this do what you want: for ($i = 0, $j = 0; $j = 5, $i < 10, $j < 5; $i++, $j++) or are you looking for something like this: for ($i = 0, $j = 0; (!($j = 5) || $i < 10 || $j < 5); $i++, $j++)

« previous php.windows (#22557) next »