note 92763 added to control-structures.goto

From: Date: Fri, 07 Aug 2009 22:03:50 +0000
Subject: note 92763 added to control-structures.goto
Groups: php.notes 
Request: Send a blank email to php-notes+get-159198@lists.php.net to get a copy of this message
Remember if you are not a fan of wild labels hanging around you are free to use braces in this construct creating a slightly cleaner look. Labels also are always executed and do not need to be called to have their associated code block ran. A purposeless example is below. <?php $headers = Array('subject', 'bcc', 'to', 'cc', 'date', 'sender'); $position = 0; hIterator: { $c = 0; echo $headers[$position] . PHP_EOL; cIterator: { echo ' ' . $headers[$position][$c] . PHP_EOL; if(!isset($headers[$position][++$c])) { goto cIteratorExit; } goto cIterator; } cIteratorExit: { if(isset($headers[++$position])) { goto hIterator; } } } ---- Server IP: 209.41.74.194 Probable Submitter: 64.202.160.65 ---- Manual Page -- http://www.php.net/manual/en/control-structures.goto.php Edit -- https://master.php.net/note/edit/92763 Del: integrated -- https://master.php.net/note/delete/92763/integrated Del: useless -- https://master.php.net/note/delete/92763/useless Del: bad code -- https://master.php.net/note/delete/92763/bad+code Del: spam -- https://master.php.net/note/delete/92763/spam Del: non-english -- https://master.php.net/note/delete/92763/non-english Del: in docs -- https://master.php.net/note/delete/92763/in+docs Del: other reasons-- https://master.php.net/note/delete/92763 Reject -- https://master.php.net/note/reject/92763 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159198) next »