Search code examples
phperror-reporting

error reporting issues


I'm still entangled in error handling problems. After having read and tried lots of different scripts, I still do not have an overall insight on the problem.

I made a syntax error on purpose and get the following error message :

Parse error: syntax error, unexpected '{' in /home/directory/public_html/mypage.php on line 10

To understand how it work, as a first step, I'd like to remove this message(which I'am able to do) and replace it by a custom one.

How can I customize this message ?

Thanks a lot.


Solution

  • You need to use set_error_handler. It enables you to catch thrown erros and do whatever you want with it.