3v4l.org

run code in 300+ PHP versions simultaneously
<?php // lint >= 8.1 namespace MissingMagicSerializationMethods; use Serializable; enum myEnum implements Serializable { case X; case Y; public function serialize() { } public function unserialize($data) { } }
Output for 8.1.0 - 8.1.10
Deprecated: MissingMagicSerializationMethods\myEnum implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/tKdD6 on line 8 Fatal error: Enums may not implement the Serializable interface in /in/tKdD6 on line 8
Process exited with code 255.
Output for 8.0.1 - 8.0.23
Parse error: syntax error, unexpected identifier "myEnum" in /in/tKdD6 on line 8
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected 'myEnum' (T_STRING) in /in/tKdD6 on line 8
Process exited with code 255.

preferences:
205.33 ms | 1395 KiB | 70 Q