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.11
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.31
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 hhvm-3.22.0
Warning: blah() expects exactly 1 parameter, 0 given in /in/aFqCg on line -1 Fatal error: Uncaught TypeError: Argument 1 passed to Blah::blah() must be an instance of X, undefined variable given in /in/aFqCg:-1 Stack trace: #0 /in/aFqCg(-1): Blah->blah() #1 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.3
Warning: blah() expects exactly 1 parameter, 0 given in /in/aFqCg on line 11 Fatal error: Uncaught TypeError: Argument 1 passed to Blah::blah() must be an instance of X, undefined variable given in /in/aFqCg:11 Stack trace: #0 /in/aFqCg(19): Blah->blah() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Warning: blah() expects exactly 1 parameter, 0 given in /in/aFqCg on line 11 Catchable fatal error: Argument 1 passed to Blah::blah() must be an instance of X, undefined variable given in /in/aFqCg on line 11
Process exited with code 255.
Output for 5.3.17 - 5.6.38
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.