codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php // START Boilerplate... Ignore me.. function handle($code, $string, $file, $line, $context) { throw new Exception($string); } set_error_handler('handle', E_ALL); // END Boilerplate... Ignore me.. function divide($x, $y) { $exception = NULL; try { try { $result = $x / $y; echo "result is " . $result . "\n"; } catch (Exception $e) { echo "division by zero!\n"; throw new Exception('division by zero'); } } catch (Exception $e) { $exception = $e; } echo "executing finally clause\n"; if ( ! is_null($exception)) throw $e; } echo "=====\n"; divide(2, 1); echo "=====\n"; divide(2, 0); echo "=====\n";
Private
[
?
]
Run code
Submit