-4

Is it possible to write a custom error handler function?

Now if there is an error on my website, then the server prints it into the result html. But I would like to create an error handler function instead.

function errorhandler($error) {
    echo '<span class="e">'.$error.'</span>';
}

// rest of the PHP file...
don kaka
  • 1,179
  • 2
  • 12
  • 28

1 Answers1

1

Have a look at set_error_handler function. Not sure how useful this is to you.

While you want to "create an error handler function", you haven't decided what you want to do with it. I don't want to guess, but perhaps by your initial statement you mentioned that it outputs it to the HTML. You could change this output in your php.ini or at a higher level depending on your server access privileges: http://www.php.net/manual/en/errorfunc.configuration.php

scappa
  • 56
  • 7