note 113328 added to language.exceptions
| From: | jim at anderos dot com | Date: | Fri, 27 Sep 2013 17:22:53 +0000 |
| Subject: | note 113328 added to language.exceptions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196395@lists.php.net to get a copy of this message | ||
If you are using a namespace, you must indicate the global namespace when using Exceptions.
<?php
namespace alpha;
function foo(){
throw new \Exception("Something is wrong!");
// throw new Exception(""); will fail
}
try {
foo();
} catch( \Exception $e ) {
// catch( Exception $e ) will give no warning, but will not catch Exception
echo "ERROR: $e";
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 71.60.142.239
----
Manual Page -- http://php.net/manual/en/language.exceptions.php
Edit -- https://master.php.net/note/edit/113328
Del: integrated -- https://master.php.net/note/delete/113328/integrated
Del: useless -- https://master.php.net/note/delete/113328/useless
Del: bad code -- https://master.php.net/note/delete/113328/bad+code
Del: spam -- https://master.php.net/note/delete/113328/spam
Del: non-english -- https://master.php.net/note/delete/113328/non-english
Del: in docs -- https://master.php.net/note/delete/113328/in+docs
Del: other reasons-- https://master.php.net/note/delete/113328
Reject -- https://master.php.net/note/reject/113328
Search -- https://master.php.net/manage/user-notes.php