Posts Tagged debug_backtrace
PHP error handling
Posted by Howard Yeend in PHP on July 5, 2009
Does this type of error handling code look familiar?
function doFunction($var) {
if(is_numeric($var)) {
/* do some stuff*/
} else {
return -1;
}
}
BLEH. How ugly is that? There’s no indication whether -1 is actually an error or a valid return value, or what it means. And other functions might use false to indicate errors so there’s inconsistency. So I’ve written a very simple function to help you give meaningful PHP error messages.
Read the rest of this entry »
Recent Comments