Re: PHP 5.1

From: Date: Mon, 06 Jun 2005 14:34:44 +0000
Subject: Re: PHP 5.1
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-16441@lists.php.net to get a copy of this message
Derick Rethans wrote: >>I think, better (cleaner) way is extend 'break' and 'continue' to accept >>string as label name in local scope. (like java :)). >> >>Implement 'goto' with possibility to jump anywhere is a step backwards... > > > It's exactly the same as "break <label>"... goto can only jump in the > same scope with a label. So I don't see the difference. > > Derick > It's not same, but it's same, look: for( ... ) { while( ... ) { if(cond) goto exit; } } exit: is equivalent with: exit: for( ... ) { while( ... ) { if(cond) break exit; } } or for( ... ) { while( ... ) { if(cond) break 2; } } goto <label>: - we can jump into another loop, not so good break/continue <label> - little confusing syntax: break terminate executing labeled statement and transfer control to the next statement. I don't need 'goto' but I prefer to extend break/continue. Always if possible to set a flag in loop and use it to escape... :) goto can help, but mostly create unreadable code... -- Ondrej Ivanic (ondrej@kmit.sk)

« previous php.internals (#16441) next »