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
([EMAIL PROTECTED])
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php