note 99803 added to language.exceptions

From: Date: Wed, 08 Sep 2010 09:31:28 +0000
Subject: note 99803 added to language.exceptions
Groups: php.notes 
Request: Send a blank email to php-notes+get-172371@lists.php.net to get a copy of this message
Be careful when you set variables inside a try block, they are still declared outside the block. Note that it is the case for every block constructions in PHP, but it can be useful to be aware of it :) <?php try { $a = "blabla"; } catch (Exception $e) {} echo isset($a) ? ":)" : ":("; // Gives ":)" echo isset($b) ? ":)" : ":("; // Gives ":(" ?> ---- Server IP: 69.147.83.197 Probable Submitter: 81.244.157.242 ---- Manual Page -- http://www.php.net/manual/en/language.exceptions.php Edit -- https://master.php.net/note/edit/99803 Del: integrated -- https://master.php.net/note/delete/99803/integrated Del: useless -- https://master.php.net/note/delete/99803/useless Del: bad code -- https://master.php.net/note/delete/99803/bad+code Del: spam -- https://master.php.net/note/delete/99803/spam Del: non-english -- https://master.php.net/note/delete/99803/non-english Del: in docs -- https://master.php.net/note/delete/99803/in+docs Del: other reasons-- https://master.php.net/note/delete/99803 Reject -- https://master.php.net/note/reject/99803 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172371) next »