note 70124 deleted from language.exceptions by betz

From: Date: Thu, 12 Oct 2006 14:24:59 +0000
Subject: note 70124 deleted from language.exceptions by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118455@lists.php.net to get a copy of this message
Note Submitter: ---- @dexen at google dot me dot up I think you just re-invented the 'finally' keyword. This code snippet will do basically the same (and does it cleaner) as your 'locker class': <?php function updateStuff() { DB::query('LOCK TABLES a, b, c WRITE'); try { someFunction(); } catch(Exception $e) { // handle exception } finally { /* Will ALLWAYS be executed */ DB::query('UNLOCK TABLES'); } } ?>

« previous php.notes (#118455) next »