Finally¶
Finally is the default clause of a try-catch expression. It is run after all the catch clauses have been called.
Finally is run every time after a try, with or without any catch clause. It is also run before the return expression, if any.
<?php
try{
doSomething();
} catch (\Exception $e) {
print "An exception was raised and caught";
} finally {
print "Finally\n";
}
?>
See also How to use Try - Catch - Finally in PHP
Added in PHP 7.0