3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class C { private $s; public function __construct($s) { $this->s = $s; } protected function getS() { return $this->s; } } class C1 extends C { public function __construct($s1) { parent::__construct($s1); } function doStuff() { echo $this->getS(); echo $this->s; } } $c1 = new C1(); $c1->doStuff();
based on KGNs1
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function C1::__construct(), 0 passed in /in/5E5AT on line 23 and exactly 1 expected in /in/5E5AT:14 Stack trace: #0 /in/5E5AT(23): C1->__construct() #1 {main} thrown in /in/5E5AT on line 14
Process exited with code 255.
Output for 5.3.20 - 7.0.20
Warning: Missing argument 1 for C1::__construct(), called in /in/5E5AT on line 23 and defined in /in/5E5AT on line 14 Notice: Undefined variable: s1 in /in/5E5AT on line 15 Notice: Undefined property: C1::$s in /in/5E5AT on line 19