note 90073 added to control-structures.if

From: Date: Sun, 05 Apr 2009 01:13:23 +0000
Subject: note 90073 added to control-structures.if
Groups: php.notes 
Request: Send a blank email to php-notes+get-152821@lists.php.net to get a copy of this message
Although most programmers are aware of this already, if for whatever reason you need to 'break' out of an if() block (which, unlike switch() is not considered a looping structure) just wrap it in an appropriate looping structure, such as a do-while(false): <?php do if ($foo) { // Do something first... // Shall we continue with this block, or exit now? if ($abort_if_block) break; // Continue doing something... } while (false); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 76.2.25.104 ---- Manual Page -- http://www.php.net/manual/en/control-structures.if.php Edit -- https://master.php.net/note/edit/90073 Del: integrated -- https://master.php.net/note/delete/90073/integrated Del: useless -- https://master.php.net/note/delete/90073/useless Del: bad code -- https://master.php.net/note/delete/90073/bad+code Del: spam -- https://master.php.net/note/delete/90073/spam Del: non-english -- https://master.php.net/note/delete/90073/non-english Del: in docs -- https://master.php.net/note/delete/90073/in+docs Del: other reasons-- https://master.php.net/note/delete/90073 Reject -- https://master.php.net/note/reject/90073 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152821) next »