note 111343 added to function.exit

From: Date: Sat, 09 Feb 2013 11:19:47 +0000
Subject: note 111343 added to function.exit
Groups: php.notes 
Request: Send a blank email to php-notes+get-193566@lists.php.net to get a copy of this message
Another way to avoid exit is to add a conditional branch (i.e. an if). <?php $task=someoperation(); if (!$task) { // for example, the task failed so we exit asap. exit(); } //... rest of the code... ?> is analog to : <?php $task=someoperation(); if (!$task) { // the task failed, so we do nothing and "jump" to the end of the code //... rest of the code... } ?> Most of the case, to use exit is cleaner than to add a big branch. ---- Server IP: 69.147.83.199 Probable Submitter: 190.162.98.84 ---- Manual Page -- http://php.net/manual/en/function.exit.php Edit -- https://master.php.net/note/edit/111343 Del: integrated -- https://master.php.net/note/delete/111343/integrated Del: useless -- https://master.php.net/note/delete/111343/useless Del: bad code -- https://master.php.net/note/delete/111343/bad+code Del: spam -- https://master.php.net/note/delete/111343/spam Del: non-english -- https://master.php.net/note/delete/111343/non-english Del: in docs -- https://master.php.net/note/delete/111343/in+docs Del: other reasons-- https://master.php.net/note/delete/111343 Reject -- https://master.php.net/note/reject/111343 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193566) next »