HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

get_exception_handler

Description

The get_exception_handler of Error Handling for PHP gets the user-defined exception handler function.

Syntax

get_exception_handler(): ?callable

Return

Returns the currently defined exception handler. If no handler is defined, null is returned.

The returned handler is the exact callable value that was passed to set_exception_handler() to define it.

Examples

1 · default

<?

$return = get_exception_handler();

var_dump($return);
NULL

2 · user-defined

<?

function handler($ex)
{
    echo __FUNCTION__. PHP_EOL.
    $ex->getMessage();
}

$callback = "handler";

set_exception_handler($callback);

$return = get_exception_handler();

var_dump($return === $callback);
bool(true)