PHP Control Structures goto


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!:

goto MyLabel;
echo 'This text will be skipped, because of the jump.';
echo 'Hello World!';