3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class x { function test(x $x) { var_dump($x); } } class y extends x { } (new y)->test(null);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to x::test() must be an instance of x, null given, called in /in/UuE4L on line 14 and defined in /in/UuE4L:4 Stack trace: #0 /in/UuE4L(14): x->test(NULL) #1 {main} thrown in /in/UuE4L on line 4
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Catchable fatal error: Argument 1 passed to x::test() must be an instance of x, null given, called in /in/UuE4L on line 14 and defined in /in/UuE4L on line 4
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/UuE4L on line 14
Process exited with code 255.