Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$e = null;
try {
throw new RuntimeException('foo');
} catch (Exception $e) {
// Catch and set $e if Exception thrown.
} finally {
// Do something
if (isset($e)) {
throw new $e;
}
}
<?php
$result = true;
try {
throw new RuntimeException('foo');
} catch (Exception $e) {
// Catch and set $e if Exception thrown.
$result = false;
} finally {
// Do something
var_dump($e);
if (isset($e)) {
throw new $e;
}
}
<?php
$result = false;
try {
if ($f) {
throw new RuntimeException('foo');
}
$result = true;
} finally {
// Do something
var_dump($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.