PHP set_exception_handler() function

The set_exception_handler() is an inbuilt function of PHP and is used to sets a user-defined exception handler function. It will returns the name of the previously defined exception handler, or NULL on error. If no previous handler was defined, NULL is also returned.

PHP set_exception_handler() function example

Example #1 set_exception_handler() function example

Example #2 set_exception_handler() function example

If you want a class instance to handle the exception, this is how you do it.


If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.