restore_error_handler 함수

restore_error_handler 함수는 set_error_handler 호출 이전에 설정되었던 이전 오류 처리기를 복원합니다. 이 함수는 매개변수를 받지 않으며 항상 true를 반환합니다.

구문

phprestore_error_handler();

예시

사용자 정의 오류 처리기를 생성한 후 표준 처리기로 복원해 봅시다:

php<?php
  function customErrorHandler($errno, $errstr) {
    echo "Custom error: [$errno] $errstr";
  }
  
  set_error_handler("customErrorHandler");
  echo $test; // 사용자 정의 처리기를 호출함
  
  restore_error_handler();
  echo $test; // 이제 PHP 표준 처리기를 호출함
?>

예시

함수의 반환 값을 확인해 봅시다:

php<?php
  $res = restore_error_handler();
  var_dump($res);
?>

코드 실행 결과:

phptrue