note 82137 deleted from function.restore-error-handler by betz

From: Date: Sat, 29 Mar 2008 23:02:22 +0000
Subject: note 82137 deleted from function.restore-error-handler by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137738@lists.php.net to get a copy of this message
Note Submitter: edgarinvillegas at hotmail dot com ---- Isole is kind of wrong. The handlers are stacked with set_error_handler, and popped with restore_error_handler(). Here i put an example: <?php mysql_connect("inexistent"); //Generate an error. The actual error handler is set by default function foo1() {echo "<br>Error foo1<br>";} function foo2() {echo "<br>Error foo2<br>";} function foo3() {echo "<br>Error foo3<br>";} set_error_handler("foo1"); //current error handler: foo1 set_error_handler("foo2"); //current error handler: foo2 set_error_handler("foo3"); //current error handler: foo3 mysql_connect("inexistent"); restore_error_handler(); //now, current error handler: foo2 mysql_connect("inexistent"); restore_error_handler(); //now, current error handler: foo1 mysql_connect("inexistent"); restore_error_handler(); //now current error handler: default handler mysql_connect("inexistent"); ?>

« previous php.notes (#137738) next »