Is there any point in using the finally
block in PHP? If it always runs no matter what, could you just not have it in the block? For example, these will output the same:
1.
try {
echo 'Hello';
switch(false) {
case 1==2:
throw new Exception('error');
break;
}
} catch(Exception $e) {
echo $e->getMessage();
} finally {
echo 'World';
}
2.
try {
echo 'Hello';
switch(false) {
case 1==2:
throw new Exception('error');
break;
}
} catch(Exception $e) {
echo $e->getMessage();
}
echo 'World';
They'll both echo:
Hello
error
World
This confuses me Lol