June 2005
Intermediate
720 pages
20h 6m
English
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 ...
Read now
Unlock full access