note 117276 added to language.namespaces.global

From: Date: Fri, 15 May 2015 08:00:00 +0000
Subject: note 117276 added to language.namespaces.global
Groups: php.notes 
Request: Send a blank email to php-notes+get-202520@lists.php.net to get a copy of this message
In namespaced context the Exception class needs to be prefixed with global prefix operator. <?php namespace hey\ho\lets\go; class MyClass { public function failToCatch() { try { $thing = somethingThrowingAnException(); } catch (Exception $ex) { // Not catched } } public function succeedToCatch() { try { $thing = somethingThrowingAnException(); } catch (\Exception $ex) { // This is now catched } } } ---- Server IP: 72.52.91.14 Probable Submitter: 193.166.223.5 (proxied: 193.166.214.189) ---- Manual Page -- http://php.net/manual/en/language.namespaces.global.php Edit -- https://master.php.net/note/edit/117276 Del: integrated -- https://master.php.net/note/delete/117276/integrated Del: useless -- https://master.php.net/note/delete/117276/useless Del: bad code -- https://master.php.net/note/delete/117276/bad+code Del: spam -- https://master.php.net/note/delete/117276/spam Del: non-english -- https://master.php.net/note/delete/117276/non-english Del: in docs -- https://master.php.net/note/delete/117276/in+docs Del: other reasons-- https://master.php.net/note/delete/117276 Reject -- https://master.php.net/note/reject/117276 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202520) next »