Функция restore_exception_handler
Функция restore_exception_handler set_exception_handler ёрдамида алмаштирилган олдинги исклюциялар ишловчисини
тиклайди. Бу функция параметрлар қабул қилмайди ва қиймат қайтармайди.
Синтаксис
restore_exception_handler();
Мисол
Келинг, фойдаланувчининг исклюциялар ишловчисини ўрнатиб кўйамиз, сўнгра олдингисини тиклаймиз:
<?php
function customExceptionHandler($exception) {
echo 'Custom handler: ' . $exception->getMessage();
}
set_exception_handler('customExceptionHandler');
restore_exception_handler();
?>
Мисол
Тиклашдан сўнг ишловчининг стандарт механизми ишлашини текширамиз:
<?php
set_exception_handler(function($exception) {
echo 'Handler 1: ' . $exception->getMessage();
});
set_exception_handler(function($exception) {
echo 'Handler 2: ' . $exception->getMessage();
});
restore_exception_handler();
throw new Exception('Test error');
?>
Кодни бажариш натижаси:
'Handler 1: Test error'