3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); final class C { public const VALUE = [] & 'str'; } var_dump((new ReflectionClassConstant(C::class, 'VALUE'))->getValue());
Output for 8.3.0 - 8.3.12
Fatal error: Uncaught TypeError: Unsupported operand types: array & string in /in/1vZ7H:7 Stack trace: #0 /in/1vZ7H(10): [constant expression]() #1 /in/1vZ7H(10): ReflectionClassConstant->getValue() #2 {main} thrown in /in/1vZ7H on line 7
Process exited with code 255.
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.24
Fatal error: Uncaught TypeError: Unsupported operand types: array & string in /in/1vZ7H:10 Stack trace: #0 /in/1vZ7H(10): ReflectionClassConstant->getValue() #1 {main} thrown in /in/1vZ7H on line 10
Process exited with code 255.

preferences:
28.1 ms | 407 KiB | 5 Q