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 { function do() { echo $this->getS(); echo $this->s; } } $c1 = new C1(); $c1->do();
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function C::__construct(), 0 passed in /in/JnOvh on line 20 and exactly 1 expected in /in/JnOvh:5 Stack trace: #0 /in/JnOvh(20): C->__construct() #1 {main} thrown in /in/JnOvh on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Missing argument 1 for C::__construct(), called in /in/JnOvh on line 20 and defined in /in/JnOvh on line 5 Notice: Undefined variable: s in /in/JnOvh on line 6 Notice: Undefined property: C1::$s in /in/JnOvh on line 16
Output for 5.4.10 - 5.6.28
Parse error: syntax error, unexpected 'do' (T_DO), expecting identifier (T_STRING) in /in/JnOvh on line 14
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/JnOvh on line 14
Process exited with code 255.