3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { protected const int|string|X C = 1; } class B extends A { protected const int|string|Y C = 'a'; }
Output for 8.5.0 - 8.5.7
Fatal error: Type of B::C must be compatible with A::C of type X|string|int in /in/KWbU7 on line 7 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.3.0 - 8.3.31, 8.4.1 - 8.4.22
Fatal error: Type of B::C must be compatible with A::C of type X|string|int in /in/KWbU7 on line 7
Process exited with code 255.
Output for 8.2.31
Parse error: syntax error, unexpected token "|", expecting "=" in /in/KWbU7 on line 4
Process exited with code 255.

preferences:
58.28 ms | 734 KiB | 4 Q