RE: [PHP] set_error_handler()

From: Date: Mon, 16 Apr 2001 22:14:06 +0000
Subject: RE: [PHP] set_error_handler()
Groups: php.general 
Request: Send a blank email to php-general+get-48815@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. After thinking about it some more, I'm doing this. Not sure if this is the best way to go about it, but it allows me to do what I want: <? function errorWrapperFunction( ... error_handler_vars ... ) { global $ErrorClassName; $ErrorClassName->errorHandlerMethod( ... error_handler_vars ... ); } class ErrorHandlerClass { // constructor function ErrorHandlerClass() { $GLOBALS["ErrorClassName"] = get_class( $this ); } } $old_error_handler = set_error_handler( "errorWrapperFunction" ); ?> That way, I can still use my class to do everything else and handle the errors when and where I need/want. Chris

« previous php.general (#48815) next »