Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php $connection = null; try { $connection = openDatabase(); $data = fetchData($connection); processData($data); } catch (DatabaseException $e) { error_log("DB error: " . $e->getMessage()); throw $e; // Re-throw after logging } catch (Exception $e) { error_log("Unexpected: " . $e->getMessage()); } finally { // Close connection even if exception was thrown if ($connection) { $connection->close(); } }
Result
Open