PHP goto


Example

The goto operator allows to jump to another section in the program. It's available since PHP 5.3.

The goto instruction is a goto followed by the desired target label: goto MyLabel;.

The target of the jump is specified by a label followed by a colon: MyLabel:.

This example will print Hello World!:

<?php
goto MyLabel;
echo 'This text will be skipped, because of the jump.';
 
MyLabel:
echo 'Hello World!';
?>