3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!class_exists('Error', false)) { // We can't really avoid making this extend Exception in PHP 5. class Error extends Exception { } } if (!class_exists('TypeError', false)) { class TypeError extends Error { } } try { throw new TypeError("Blah"); /* } catch ( TypeError $e ) { die( 'TypeError' ); } catch ( Error $e ) { die( 'Error' );*/ } catch ( Exception $e ) { die( 'Exception' ); }

preferences:
46.95 ms | 402 KiB | 5 Q