3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeClass { protected string $b; } class AChild extends SomeClass { protected $b; }
Output for 8.1rc1 - rc2
Fatal error: Type of AChild::$b must be string (as in class SomeClass) in /in/X9Yvd on line 8
Process exited with code 255.
Output for 7.4.1 - 7.4.24, 8.0.0 - 8.0.11
Fatal error: Type of AChild::$b must be string (as in class SomeClass) in /in/X9Yvd on line 11
Process exited with code 255.
Output for 7.4.0
Fatal error: Type of AChild::$ must be string (as in class SomeClass) in /in/X9Yvd on line 11
Process exited with code 255.
Output for 7.3.0 - 7.3.31
Parse error: syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/X9Yvd on line 5
Process exited with code 255.

preferences:
33.99 ms | 459 KiB | 5 Q