(PHP 8 >= 8.5.0)
get_exception_handler — ユーザー定義の例外ハンドラ関数を取得する
この関数にはパラメータはありません。
   現在定義済みの例外ハンドラを返します。
   ハンドラが定義されていない場合は、null を返します。
  
返されたハンドラは、 set_exception_handler() に渡された callable そのものです。
例1 get_exception_handler() の例
<?php
$handler = function (Throwable $ex) {
     echo "Exception: " . $ex::class . ": " . $ex->getMessage() . "\n";
};
var_dump(get_exception_handler()); // NULL
set_exception_handler($handler);
var_dump(get_exception_handler() === $handler); // bool(true)
?>PHP 8.5.0 より前のバージョンでは、 この関数の機能は以下のような polyfill で提供できます:
<?php
if (!function_exists('get_exception_handler')) {
    function noop_exception_handler() {
    }
    function get_exception_handler(): ?callable {
        $handler = set_exception_handler('noop_exception_handler');
        restore_exception_handler();
        return $handler;
    }
}
?>