How do I change the error output of a php error? For example if its a syntax error, or a server side time out, i want to echo a message that allows the user to refresh the page.
Heres the code I want to add my error message to:
$XML->registerXPathNamespace('tree','www.tree.com'); <--occasionally errors here, so I want to output my own error message.
Use the function
set_error_handlerto define a custom function to be called when there is an error. You can then decide to do whatever you want within that function with the error.If you only want it for a specific duration, you can restore it afterwards with
restore_error_handler.