if i have the code below:
try {
//call function a
$object->function_a();
//call function b
$object->function_b();
//call function c
$object->function_c();
}
catch(Exception $e) {
$error->track_error();
}
how can i catch syntax errors, like someone is changing the function_b() name to function_d() which doesn't exists.
it seems that try and catch doesn't catch syntax errors, it doesn't work without an if statement to check if something is wrong.
but if i can expect an error with an if statement, why do i need try and catch, i can just write something like this:
if(//something is false) {
$error->track_error();
}
what i'm looking is something that will create an exception and jump to a catch block on the whole try scope, when any php error (including syntax) is happening, catch it and then get the details with error_get_last() or similar function for error logging inside the db.
is this possible?