3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo rand();die(); class ExceptionX extends Exception { } class ExceptionY extends Exception { } class ExceptionZ extends Exception { } function t() { throw new ExceptionZ(); } try { t(); } catch (Exception $e) { switch(get_class($e)) { case 'ExceptionX': /** fall through */ case 'ExceptionY': /** fall through */ /* handle the ones we want here */ break; default: throw $e; } }

preferences:
29.75 ms | 402 KiB | 5 Q