3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum Foo: string { case Bar = 'bar'; case Baz = 'baz'; } $bar = Foo::Bar; var_dump($bar->value);
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
string(3) "bar"
Output for 7.3.13 - 7.3.33, 7.4.0 - 7.4.26
Parse error: syntax error, unexpected 'Foo' (T_STRING) in /in/kIdJu on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.13
Parse error: syntax error, unexpected identifier "Foo" in /in/kIdJu on line 3
Process exited with code 255.

preferences:
39.34 ms | 1143 KiB | 11 Q