3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T { public function __construct() { parent::__construct(42); } } class A { use T; public function __construct($v) { var_dump($v); } } new A();
based on s3ujQ
Output for 7.1.0 - 7.3.0rc3
Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::__construct(), 0 passed in /in/PAvAi on line 13 and exactly 1 expected in /in/PAvAi:9 Stack trace: #0 /in/PAvAi(13): A->__construct() #1 {main} thrown in /in/PAvAi on line 9
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
Warning: Missing argument 1 for A::__construct(), called in /in/PAvAi on line 13 and defined in /in/PAvAi on line 9 Notice: Undefined variable: v in /in/PAvAi on line 10 NULL
Output for hhvm-3.15.4
Warning: __construct() expects exactly 1 parameter, 0 given in /in/PAvAi on line 10 Notice: Undefined variable: v in /in/PAvAi on line 10 NULL