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) { parent::__construct($a, $b); } } $baz = new Baz("foo", "bar");
based on dbc21
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/dsE92:20 Stack trace: #0 /in/dsE92(24): Baz->__construct('foo', 'bar') #1 {main} thrown in /in/dsE92 on line 20
Process exited with code 255.
Output for 5.3.20 - 5.6.21
Fatal error: Cannot access parent:: when current class scope has no parent in /in/dsE92 on line 20
Process exited with code 255.