restore_error_handlerDescriptionCalling restore_error_handler() removes the current custom error handler (if any) and returns to using the previously defined error handler. If no custom error handler has been defined, calls to this function are harmless. The function accepts no arguments. ExampleExample 272. Demonstrate how restore_error_handler() behaves <pre> <?php // Define several trivial custom error handlers function custom_handler_one ($errno, $errstr, $errfile, $errline) { echo "custom_handler_one $errostr ($errno) in file $errfile on line $errline\n"; } function custom_handler_two ($errno, $errstr, $errfile, $errline) { echo "custom_handler_two $errostr ($errno) in file $errfile on line $errline\n"; } // Trigger an error - catch it with PHP's built-in error handler trigger_error ("Some error"); // Set the first custom error handler set_error_handler ('custom_handler_one'); trigger_error ("Some error"); // Set the second custom error handler set_error_handler ('custom_handler_two'); trigger_error ("Some error"); // Return to using the previous error handler restore_error_handler(); trigger_error ("Some error"); // Return to using the default error handler restore_error_handler(); trigger_error ("Some error"); ?> </pre>
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|