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.9
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.32, 8.4.1 - 8.4.24
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 - 8.2.32
Parse error: syntax error, unexpected token "|", expecting "=" in /in/KWbU7 on line 4
Process exited with code 255.

preferences:
56.34 ms | 757 KiB | 4 Q