w3resource
PHP Tutorial

PHP error handling function set_exception_handler()

Description 

PHP set_exception_handler() calls a user-defined function as parameter for exception handling.

Version:

PHP 5

Syntax:

set_exception_handler (user-defined-function)

Parameter:

Parameters Description Required / Optional Type
user-defined-function A user defined function. Required callback

Return Values:

The function returns the name of the user-defined exception handler or NULL on error.

If no previous exception handler was defined, then also NULL is returned.

Example:

 <?php 
function w3r_exception_handler($w3r_exception) 
{   echo "Uncaught exception: " , 
$exception->getMessage(), 
"\n"; } 
set_exception_handler('w3r_exception'); 
throw new Exception('Uncaught Exception'); 
echo "Not Executed\n"; 
?> 


New Content: Composer: Dependency manager for PHP, R Programming