Created
April 29, 2019 10:41
-
-
Save MarioBlazek/9e5dff34221796960cdd87e9aa67f8f1 to your computer and use it in GitHub Desktop.
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 MyCustomException extends Exception { } | |
function exception_handler($exception) { | |
echo "Uncaught exception: " , $exception->getMessage(), "\n"; | |
} | |
set_exception_handler('exception_handler'); | |
try { | |
throw new Exception('Uncaught Exception'); | |
} catch (MyCustomException $e) { | |
echo "Your custom exception caught "; | |
echo $e->getMessage(); | |
} finally { | |
echo "I'm always here"; | |
} | |
print "Not executed"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment