3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum MyEnum: string { case value = 'value'; } $object = new \stdClass(); $enum = MyEnum::value; $payload = 'payload'; $map = new \SplObjectStorage(); $map[$object] = $payload; $map[$enum] = $payload; foreach ($map as $key => $value) { var_dump($key, $value); }
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.5 - 8.3.14
int(0) object(stdClass)#1 (0) { } int(1) enum(MyEnum::value)
Output for 8.0.1 - 8.0.28
Parse error: syntax error, unexpected identifier "MyEnum" in /in/gloDO on line 3
Process exited with code 255.

preferences:
32.69 ms | 407 KiB | 5 Q