Jump to content
Larry Ullman's Book Forums

Function My_Error_Handler: When Is It Ever Called?


Recommended Posts

Hello friends! Please kindly note that I am having problems understanding the function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) in the configuration file because I never seem to encounter it being called in the e-commerce paypal site design.

 

I just noticed, in a second read, that it has the following code apply:

set_error_handler('my_error_handler');

 

Please kindly forgive my lack of foresight, but what are the implications of the function my_error_handler being attached to the custom function set_error_handler for handling errors. For instance, how would it be invoked in the code later on? and what exactly is a custom function for handling errors. Please kindly clarify?

 

Thank you so very much to everyone and anyone who provides some sort of clarification. Bless you all!

Link to comment
Share on other sites

The my_error_handler() function, once set in PHP (aka, registered), will be invoked whenever an error occurs. You would want to use it to handle errors more gracefully than the default way PHP reports errors. This might mean formatting errors in a style that works with your site, or taking other steps, such as emailing and logging errors.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...