set_exception_handler

It sets a user-defined function to handle exception

Example

<?php
function customException($exception){
echo  $exception->getMessage();
}
set_exception_handler(‘customException’);
throw new Exception(‘Uncaught Exception occurred’);
?>

Output

Exception: Uncaught Exception occurred