Last active
December 18, 2015 22:48
-
-
Save marxjohnson/5856890 to your computer and use it in GitHub Desktop.
PHP finally keyword
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks Tim, good example.