3v4l.org

run code in 500+ PHP versions simultaneously
<?php class SkipProtectedPropertyOnNonFinalClass { protected int $value = 5; public function __construct(int $value) { $this->value = $value; } public function getValue() { return $this->value; } } class SomeChild extends SkipProtectedPropertyOnNonFinalClass { public function __construct() { } } $obj = new SomeChild(); echo $obj->getValue();
Output for 7.2.17
Parse error: syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/PNpBG on line 5
Process exited with code 255.
Output for 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
5

preferences:
29.33 ms | 1499 KiB | 8 Q