02
Jul

I am working a lot with PHP, and also developing on a live CMS. Because there are already people using the system i don’t want errors to appear.

So, i tried to find a way to fix that. And, i found it. Ofcourse I did, because else this post wouldn’t excist.

This is the row that sets a new default error handler function:

$old_error_handler = set_error_handler("myErrorHandler");

And this is the function:

function myErrorHandler($errno, $errstr, $errfile, $errline)
{
   // Do something with the vars you get from this function.
  // $errno = Error number. Every type of error has an number ;)
  // $errstr = text to explain the error. The one you always see by default
  // $errfile = File the error occurred in
  // $errline = Line number in $errfile the error occurred at.
}

Check for more information www.php.net/set_error_handler

, , , , ,

Add reply