English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP restore_error_handler() Function Usage and Example

PHP Error & Loggings Reference Manual

The restore_error_handler() function restores the previous error handler

Syntax

bool restore_error_handler(void);

Definition and Usage

 After changing the error handler with set_error_handler(), this function can be used to restore the previous error handler (which can be built-in or user-defined).

Parameter

Serial NumberParameters and Description
1

void

No parameters required

Return Value

This function always returns TRUE.

Online Example

The following is the usage of this function, if unserialize() causes an error, the original error handler will be restored next. 

<?php
   function unserialize_handler($errno, $errstr) {
      echo "Invalid hello value.\n";
   }
   
   $hello = 'abc';
   set_error_handler('unserialize_handler');
   
   $original = unserialize($hello);
   restore_error_handler();
?>
Test to see‹/›

This will produce the following result-

Invalid hello value.

PHP Error & Loggings Reference Manual