ID: 46158 Updated by: [EMAIL PROTECTED] Reported By: kok at nachon dot nl -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Irrelevant PHP Version: 5.2.6 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Adding this functionality would break scripts, so we'd need a new keyword which has issues... A suggested work-around is like that: if ($foo) { do { if (do_something()) { break; } do_more(); } while (0); } Previous Comments: ------------------------------------------------------------------------ [2008-09-23 11:01:41] kok at nachon dot nl Description: ------------ I read in Bug #29287 about breaking out of loops and was wondering if anyone considered breaking out of a generic compound block. This would satisfy the need for error handling without goto. Example: function connect() { { //start compound block if (!mysql_connect('host', 'user', 'pass)) break; //break out if (!mysql_select_db('database')) break; //break out return; } $code = mysql_errno(); $msg = mysql_error(); throw new Exception($msg, $code); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46158&edit=1