3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SetOnce { private $value; public function __construct($value) { $this->value = $value; } public function getValue() { return $this->value; } } class Foo { proteced $bar; function __construct($val) { $this->bar = new SetOnce($val * 2); } function getBar() { return $bar->getValue(); } }
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected 'proteced' (T_STRING), expecting function (T_FUNCTION) in /in/XY9Sc on line 14
Process exited with code 255.

preferences:
165.09 ms | 1399 KiB | 23 Q