3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { static function f() { $f = eval(' return #[A(self::U)] function () {}; '); $rf = new \ReflectionFunction($f); $rf->getAttributes()[0]->getArguments(); } } C::f();
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant self::U in /in/P9jvs:3 Stack trace: #0 /in/P9jvs(12): [constant expression]() #1 /in/P9jvs(12): ReflectionAttribute->getArguments() #2 /in/P9jvs(16): C::f() #3 {main} thrown in /in/P9jvs on line 3
Process exited with code 255.
Output for 8.2.0 - 8.2.18
Fatal error: Uncaught Error: Undefined constant self::U in /in/P9jvs:3 Stack trace: #0 /in/P9jvs(12): ReflectionAttribute->getArguments() #1 /in/P9jvs(16): C::f() #2 {main} thrown in /in/P9jvs on line 3
Process exited with code 255.
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.27
Fatal error: Uncaught Error: Undefined constant self::U in /in/P9jvs:12 Stack trace: #0 /in/P9jvs(12): ReflectionAttribute->getArguments() #1 /in/P9jvs(16): C::f() #2 {main} thrown in /in/P9jvs on line 12
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Call to undefined method ReflectionFunction::getAttributes() in /in/P9jvs:12 Stack trace: #0 /in/P9jvs(16): C::f() #1 {main} thrown in /in/P9jvs on line 12
Process exited with code 255.

preferences:
124.84 ms | 401 KiB | 120 Q