3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function __construct($a, $b) { var_dump($a, $b); } } class Bar { public function __construct($a) { var_dump($a); } } class Baz { public function __construct($a, $b) { Foo::__construct($a, $b); } } $baz = new Baz("foo", "bar");
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Non-static method Foo::__construct() cannot be called statically in /in/dbc21:20 Stack trace: #0 /in/dbc21(24): Baz->__construct('foo', 'bar') #1 {main} thrown in /in/dbc21 on line 20
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Non-static method Foo::__construct() cannot be called statically, assuming $this from incompatible context in /in/dbc21 on line 20
Process exited with code 255.