3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo {} function derp(Foo $foo) { return $foo; } var_dump(derp(new Foo), derp(null), derp());
based on beJrM
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to derp() must be an instance of Foo, null given, called in /in/cZYlA on line 8 and defined in /in/cZYlA:4 Stack trace: #0 /in/cZYlA(8): derp(NULL) #1 {main} thrown in /in/cZYlA on line 4
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Catchable fatal error: Argument 1 passed to derp() must be an instance of Foo, null given, called in /in/cZYlA on line 8 and defined in /in/cZYlA on line 4
Process exited with code 255.