Created
March 21, 2017 12:21
-
-
Save andybeak/30e25d4fc46f9b24d4e76d9516025720 to your computer and use it in GitHub Desktop.
PHP Exception inheritance
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 | |
class MyException extends Exception {} | |
try { | |
throw new MyException(); | |
} catch (Exception $e) { | |
echo "Parent exception"; | |
} catch (MyException $e) { | |
echo "Child exception"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment