3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { protected readonly int $foo; } class Ex extends Base { public function __construct() { $this->foo = 123; } } new Ex();
Output for 8.0.0 - 8.0.13
Parse error: syntax error, unexpected identifier "int", expecting variable in /in/UhirM on line 4
Process exited with code 255.
Output for 7.4.0 - 7.4.26
Parse error: syntax error, unexpected 'int' (T_STRING), expecting variable (T_VARIABLE) in /in/UhirM on line 4
Process exited with code 255.
Output for 7.3.0 - 7.3.33
Parse error: syntax error, unexpected 'readonly' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/UhirM on line 4
Process exited with code 255.

preferences:
203.74 ms | 1395 KiB | 80 Q