3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { const string A = '42'; const int B = +self::A; // This, below, is a compile error const int C = (int) self::A; }
Output for 8.3.0 - 8.3.22, 8.4.1 - 8.4.8
Fatal error: Constant expression contains invalid operations in /in/Rff9R on line 7
Process exited with code 255.
Output for 8.2.0 - 8.2.28
Parse error: syntax error, unexpected identifier "A", expecting "=" in /in/Rff9R on line 4
Process exited with code 255.

preferences:
151.89 ms | 1341 KiB | 6 Q