3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum DayOfWeek : int { case MONDAY = 0; case TUESDAY = 1; case WEDNESDAY = 2; case THURSDAY = 3; case FRIDAY = 4; case SATURDAY = 5; case SUNDAY = 6; } $case = 'SUNDAY'; var_dump(constant("DayOfWeek::$case"));
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
enum(DayOfWeek::SUNDAY)
Output for 8.0.1 - 8.0.22
Parse error: syntax error, unexpected identifier "DayOfWeek" in /in/8S493 on line 3
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected 'DayOfWeek' (T_STRING) in /in/8S493 on line 3
Process exited with code 255.

preferences:
22.48 ms | 1169 KiB | 6 Q