Exceptions

windows

Guest
Plz can any one explain easily how class exception work?
<!-- m --><a class="postlink" href="http://www.php.net/manual/en/language.exceptions.php">http://www.php.net/manual/en/language.exceptions.php</a><!-- m -->

I checked <!-- m --><a class="postlink" href="http://www.php.net">http://www.php.net</a><!-- m -->
but it is not clear for me. how can I make class exception and then extends it.

thank you in advanceThe Exception class is automatically defined in PHP5. If you want to extend it, just define a new class that does so:

class MyException extends Exception
{
// class definition here
}Ooh my God
I am so stupid, NogDog plz forgive me.

thx sooo muchJust as a note; much of the time the//class definition here can be empty; when you're distinguishing between different types of exception (in your catch statement, typically), it's enough to look at - well, the type (i.e., class) of exception. Assuming you make different classes for different types of exception.
 
Back
Top