Skip to content

Instantly share code, notes, and snippets.

@marxjohnson
Last active December 18, 2015 22:48
Show Gist options
  • Save marxjohnson/5856890 to your computer and use it in GitHub Desktop.
Save marxjohnson/5856890 to your computer and use it in GitHub Desktop.
PHP finally keyword
<?php
function throw_exception() {
// Arbitrary code here
throw new Exception('Hello, Joe!');
}
function some_code() {
// Arbitrary code here
}
try {
throw_exception();
} catch (Exception $e) {
echo $e->getMessage();
}
some_code();
<?php
function throw_exception() {
// Arbitrary code here
throw new Exception('Hello, Joe!');
}
function some_code() {
// Arbitrary code here
}
try {
throw_exception();
} catch (Exception $e) {
echo $e->getMessage();
} finally {
some_code();
}
@marxjohnson
Copy link
Author

Thanks Tim, good example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment