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/

Reply via email to