note 109027 added to control-structures.goto

From: Date: Thu, 14 Jun 2012 07:58:13 +0000
Subject: note 109027 added to control-structures.goto
Groups: php.notes 
Request: Send a blank email to php-notes+get-188594@lists.php.net to get a copy of this message
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: ?> ---- Server IP: 69.147.83.197 Probable Submitter: 76.95.103.115 ---- Manual Page -- http://www.php.net/manual/en/control-structures.goto.php Edit -- https://master.php.net/note/edit/109027 Del: integrated -- https://master.php.net/note/delete/109027/integrated Del: useless -- https://master.php.net/note/delete/109027/useless Del: bad code -- https://master.php.net/note/delete/109027/bad+code Del: spam -- https://master.php.net/note/delete/109027/spam Del: non-english -- https://master.php.net/note/delete/109027/non-english Del: in docs -- https://master.php.net/note/delete/109027/in+docs Del: other reasons-- https://master.php.net/note/delete/109027 Reject -- https://master.php.net/note/reject/109027 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188594) next »