There is another, not so often used, statement in PHP, that is a part of structure controlling stataments; that is the goto statement

The goto statement allows the controller to jump to a different section of a program. The section must be specified with a label followed by a colon.

Syntax of GOTO statement

<?php
    goto label;
    // code...

  
    label:
    // continue code...
?>

Example with GOTO and LABEL statements

<?php
    goto label_x;
    echo "Hello...";
    
    label_x:
    echo " World";
?>

 

›› go to examples ››