Skip to content

Try Catch Finally

The finally block executes regardless of whether an exception occurs.

try {
echo "Executing code";
} catch (Exception $e) {
echo $e->getMessage();
} finally {
echo "Cleanup executed";
}