note 50911 added to control-structures.break

From: Date: Mon, 14 Mar 2005 02:21:12 +0000
Subject: note 50911 added to control-structures.break
Groups: php.notes 
Request: Send a blank email to php-notes+get-86377@lists.php.net to get a copy of this message
instead of using the while (1) loop with break like suggested in an earlier note, I would rather recommend throwing an exception, e.g.: <?php try {   $query = "SELECT myAttr FROM myTable"; $db = DB::connect($dbUrl);   if (DB::isError($db)) { throw new Exception("Connection failed"); } /* ... */ } catch (Exception $e) { echo "Error: ".$e->getMessage()."</br>"; } ?> ---- Manual Page -- http://www.php.net/manual/en/control-structures.break.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50911 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50911&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50911&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50911&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50911&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50911&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50911&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86377) next »