RE: [PHP] set_error_handler()

From: Date: Mon, 16 Apr 2001 20:23:20 +0000
Subject: RE: [PHP] set_error_handler()
Groups: php.general 
Request: Send a blank email to php-general+get-48802@lists.php.net to get a copy of this message
> If I'm not mistaken set_error_handler() takes a string that > is the name of a function, I am sure in that function you can > instantiate whatever class you want. I thought about that. But ideally, what I'm trying to do is trap the errors with a class method (after instantiating) then print out or handle the errors all at once. Kind of like this: <pseudocode> $myErrors = new ErrorClass; $old_error_handler = set_error_handler( "myErrors->handler" ); // all of these will be caught with my class' method trigger_error( "Error 1", E_USER_WARNING ); trigger_error( "Error 2", E_USER_WARNING ); trigger_error( "Error 3", E_USER_WARNING ); $myErrors->printAllErrors(); </pseudocode> Or something along those lines. Using the function to instiate the class and process the error basically makes the class moot. Why would you really need the class in the first place? You would just have the function do all the work. Chris

« previous php.general (#48802) next »