codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php function checkNum($num) { if($num<10) { throw new Exception("Value must be more than 10"); } return true; } try { checkNum(2); // if exception is not thrown echo 'Exception not thrown'; } //catch exception catch(Exception $e) { echo 'Got You! Exception throw: ' .$e->getMessage(); } ?>
Private
[
?
]
Run code
Submit