PHP5 exception handling

From: Date: Fri, 30 Jul 2004 14:58:59 +0000
Subject: PHP5 exception handling
Groups: php.general 
Request: Send a blank email to php-general+get-192316@lists.php.net to get a copy of this message
I've done some reading on the ZE2 exception handling, but I'm not quite sure I understand how it works. I'm familiar with the following in perl: eval { do some stuff... } if ($@) { report an exception... } Which looks a lot like the following in PHP5: try { do some stuff... } catch () { } The problem I'm running into: what do I pass as arguments to catch()? The articles on ZE2 use something like: catch (Exception $e) {}, or something like catch(MyException $e) (where MyException is a class they defined in their examples). Is the 'Exception' class a base class/handler with PHP5? Do I need to create my own exception handler classes? Do I even need to catch objects of a specific type, or can I simply do: catch ($error) { do something with $error } Thanks in advance. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:matthew@garden.org | http://vermontbotanical.org

« previous php.general (#192316) next »