3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum Affinity: string { case Force = 'force'; case Magic = 'magic'; case Spirit = 'spirit'; case Void = 'void'; } var_dump(array_map($case => $case->value, Affinity::cases()));
Output for 8.1.0 - 8.1.7
Parse error: syntax error, unexpected token "=>", expecting ")" in /in/742nf on line 12
Process exited with code 255.
Output for 8.0.1 - 8.0.20
Parse error: syntax error, unexpected identifier "Affinity" in /in/742nf on line 4
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected 'Affinity' (T_STRING) in /in/742nf on line 4
Process exited with code 255.

preferences:
193.46 ms | 1399 KiB | 64 Q