Even easier you could just replace all die(
with error_handle(
or something else, and include this function:
function error_handle($err) {
die($err); // Comment this line out if you don't want the error to be displayed.
}
This is also great because you could extend the code to log errors etc in production. You could in addition define a $debug
-variable somewhere in your global code if you are using Git or other version-control-systems.
Edit: I suggest replace all die(
and not just die
to avoid replaces where you don't want it, if you e.g use die in a sentence or something.