I have no idea to handle error in php, both run-time and compile-time. I want to manage all types of errors.
Notice, Warning, Parse Error, Fatal Error
When these types of errors occur, then I want my program to throw a custom written message on page. Currently I am using try{} catch{}
, set_error_handler
:
// set to the user defined error handler
$old_error_handler = set_error_handler("myErrorHandler");
In short: I am looking for the right way to handle errors if I type wrong a variable declaration like d
instead of $d
, or if I forget a semi-colon in a line, or if I get a MySQL error.