How to use set_exception_handler() function to handle exceptions in PHP

1 Answer

0 votes
/*
throw new Exception($error_message);
*/

function exceptionFunction($exception) 
{
  echo "Exception: " . $exception->getMessage();
}

set_exception_handler('exceptionFunction');

throw new Exception('message');

        
/*
run:

Exception: message
  
*/

 



answered Jan 5, 2016 by avibootz

Related questions

...