0
One question that came to me just now is "The PHP Exception class for the system?", what I mean is, when we release an exception in the script, something after this exception remains in operation?
0
One question that came to me just now is "The PHP Exception class for the system?", what I mean is, when we release an exception in the script, something after this exception remains in operation?
5
Hello!
According to the documentation nay:
When an exception is triggered, code soon after the instruction will not be executed, and PHP will try to find the first catch block except fired. If an exception is not caught, a PHP Fatal Error will be released with a message "Uncaught Exception ...", unless a handler has been set with set_exception_handler().
0
If you need something to run even if there is an exception, you need to use "Finally".
example:
// O codigo abaixo vai imprimir: 1234
echo '1';
try {
echo '2';
throw new Exception();
} catch (Exception $e) {
echo '3';
} finally {
echo '4';
}
Reference link: http://rubsphp.blogspot.com.br/2012/11/try-catch-finally-exception-em-php.html
Browser other questions tagged php exception
You are not signed in. Login or sign up in order to post.
Sorry, but doubt was not clear
– gmsantos
What I mean is, I need to use the
die()
after launching an exception to kill the system? or is it not necessary?– Lucas Pires