3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X { } class Y extends X { } class Blah { public function blah(X $x) { $this->bleh($x); } public function bleh(Y $x) { echo "Hello\n"; } } $x = new Y; $b = new Blah; $b->blah($x);
Output for 7.1.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Blah has a deprecated constructor in /in/aFqCg on line 8 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Blah::blah(), 0 passed in /in/aFqCg on line 19 and exactly 1 expected in /in/aFqCg:9 Stack trace: #0 /in/aFqCg(19): Blah->blah() #1 {main} thrown in /in/aFqCg on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Blah has a deprecated constructor in /in/aFqCg on line 8 Fatal error: Uncaught TypeError: Argument 1 passed to Blah::blah() must be an instance of X, none given, called in /in/aFqCg on line 19 and defined in /in/aFqCg:9 Stack trace: #0 /in/aFqCg(19): Blah->blah() #1 {main} thrown in /in/aFqCg on line 9
Process exited with code 255.
Output for 5.3.17 - 5.6.28
Catchable fatal error: Argument 1 passed to Blah::blah() must be an instance of X, none given, called in /in/aFqCg on line 19 and defined in /in/aFqCg on line 9
Process exited with code 255.