3v4l.org

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