3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class D {}; class Test { function __construct(D $ddd) { var_dump($ddd); } } class Test2 extends Test { function __construct(){ echo 'test2'; } } $a = new Test; var_dump($a);
based on vFbTo
Output for 7.1.0 - 7.2.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::__construct(), 0 passed in /in/12oSq on line 15 and exactly 1 expected in /in/12oSq:5 Stack trace: #0 /in/12oSq(15): Test->__construct() #1 {main} thrown in /in/12oSq on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 1 passed to Test::__construct() must be an instance of D, none given, called in /in/12oSq on line 15 and defined in /in/12oSq:5 Stack trace: #0 /in/12oSq(15): Test->__construct() #1 {main} thrown in /in/12oSq on line 5
Process exited with code 255.
Output for hhvm-3.15.4
Warning: __construct() expects exactly 1 parameter, 0 given in /in/12oSq on line 7 Fatal error: Uncaught TypeError: Argument 1 passed to Test::__construct() must be an instance of D, undefined variable given in /in/12oSq:7 Stack trace: #0 /in/12oSq(15): Test->__construct() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Catchable fatal error: Argument 1 passed to Test::__construct() must be an instance of D, none given, called in /in/12oSq on line 15 and defined in /in/12oSq on line 5
Process exited with code 255.