Re: a for-loop syntax question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2004-01-12 at 15:11, Svensson, B.A.T. (HKG) wrote:
> 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++)

ERRATA:

for ($i = 0, $j = 0; (!($j = 5) && $i < 10 && $j < 5); $i++, $j++)

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux