note 109027 deleted from control-structures.goto by salathe

From: Date: Mon, 21 Sep 2020 14:42:53 +0000
Subject: note 109027 deleted from control-structures.goto by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215284@lists.php.net to get a copy of this message
Note Submitter: sixoclockish at gmail dot com ---- You are also allowed to jump backwards with a goto statement. To run a block of goto as one block is as follows: example has a prefix of iw_ to keep label groups structured and an extra underscore to do a backwards goto. Note the iw_end_gt to get out of the labels area <?php $link = true; if ( $link ) goto iw_link_begin; if(false) iw__link_begin: if ( $link ) goto iw_link_text; if(false) iw__link_text: if ( $link ) goto iw_link_end; if(false) iw__link_end: goto iw_end_gt; if (false) iw_link_begin: echo '<a href="#">'; goto iw__link_begin; if (false) iw_link_text: echo 'Sample Text'; goto iw__link_text; if (false) iw_link_end: echo '</a>'; goto iw__link_end; iw_end_gt: ?>

« previous php.notes (#215284) next »