Re: [PHP] How to break a while loop ?

2002-11-15 Thread Ernest E Vogelsinger
At 16:22 15.11.2002, Hacook spoke out and said:
[snip]
Hi all,
I made a while loop and i'd like to know the comand to break it from inside.
Here is my script :

while ($michou=$maxFiles){
/// My script  and ate the end :
if ($michou$michoumax) {
break;
}
}

But it doesnt work

If it doesn't work, $michou doesn't ever become  $michoumax. Check if
you're either incrementing $michou, or decrementing $michoumax correctly.

Can i put 2 conditions in the while() command ? if yes, what is the
structure ?

Yes you can:

while (expr1  expr2) {}
will loop as long BOTH expressions are true

while (expr1 || expr2) {}
will loop as long ONE OF BOTH expressions is true

You can of course put more than two expression in the while condition. If
you're using or, expression evaluation will stop when the first exression
returns true. For and, the evaluation will stop as soon as a n expression
returns false.

The fact that not all expressions are necessarily evaluated every time
needs to be considered if the expressions have side effects.


-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/



Re: [PHP] How to break a while loop ?

2002-11-15 Thread Tony Earnshaw
fre, 2002-11-15 kl. 16:22 skrev Hacook:

 I made a while loop and i'd like to know the comand to break it from inside.
 Here is my script :
 
 while ($michou=$maxFiles){
 /// My script  and ate the end :
 if ($michou$michoumax) {
 break;
 }
 }
 
 But it doesnt work
 Can i put 2 conditions in the while() command ? if yes, what is the
 structure ?
 Thanks,
 hacook

'if/continue' instead of 'if/break'? I wondered what it was doing in
alien code today, so I looked it up.

Best,

Tony

-- 

Tony Earnshaw

Cricketers are strange people. They wake up
in October, only to find that their wives had
left them in May.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl





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