PHP Goto Operator
by saravana[ Edit ] 2014-04-05 11:42:49
PHP Goto Operator
->The goto operator can be used to jump to another location in a program.
->The instruction is like goto followed by any label name.
->The target location is specified by the label name followed by a colon.
->The target label must be within the same file and context.
->Cannot jump out of a function or method and jump into loop or switch.
Example
<?php
for($i=0; $i<100; $i++) {
if($i==17) goto end;
}
echo "Loop end";
end:
echo 'Loop Jump';
?>
Output
Loop Jump