PHP error handling functions - restore_error_handler()
Description
After changing the error handler using set_error_handler(), restore_error_handler() function is used to get the previous error handler back.
Version:
PHP 4.0.1,5
Syntax:
restore_error_handler(void)
Parameter:
None.
Return Values:
This function always returns TRUE.
Example:
<?php
function err_log($error_no, $error_string)
{
$filename = '/log/php_errors.log';
if(filesize($file) > 2048)
{
rename($file, $file . (string) time( ));
clearstatcache( );
}
error_log($error_string, 3, $filename);
}
set_error_handler('err_log');>
for($i = 0; $i < 2500; $i++)
{
trigger_error(time( ) . ": This is an error.\n");
}
restore_error_handler( );
?>
Previous: error_reporting()
Next: restore_exception_handler()
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/php/error-handling/php-error-handling-function-restore_error_handler.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics