Creating Custom Error Handlers
Another option for error management with your sites (aside from adjusting the error reporting) is to alter how PHP handles errors. You can create your own functions that will overrule PHP’s default behavior (printing them out in HTML tags). For example,
function report_errors ($num, $msg) { // Do whatever here. } set_error_handler ('report_errors');
The set_error_handler() determines what function handles errors. Feeding this function the name of another function will result in that second function (e.g., report_errors) being called whenever an error is encountered. This function (report_errors) will, at that time, receive two arguments—an error number and a textual error message—which can be used in any possible ...
Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.