How to use set_exception_handler() to sets a user-defined function to handle exceptions in PHP

1 Answer

0 votes
function exception_handler_function($exception) 
{
    echo "Uncaught exception : " , $exception->getMessage(), "<br />";
}
   
set_exception_handler('exception_handler_function');
   
throw new Exception('My Exception Message');
   
echo "Not Executed<br />";
   
/*
run:

Uncaught exception : My Exception Message
 
*/

 



answered Apr 14, 2016 by avibootz

Related questions

...