3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function b(DateTime $c) { print_r($c); } } $a = new A(); try { $a->b(""); } catch (Exception $e) { echo "catched" . $e->getMessage(); } } catch (TypeError $e) { echo "subidubi" . $e->getMessage(); }
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.29, 5.6.8 - 5.6.13
Parse error: syntax error, unexpected '}' in /in/4H0HO on line 17
Process exited with code 255.

preferences:
191.76 ms | 1395 KiB | 62 Q