3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { static function f() { $php = ' namespace U; return #[A(self::U)] static function () {}; '; return eval($php); } } $rf = new \ReflectionFunction(C::f()); $ra = $rf->getAttributes()[0]; $ra->getArguments();
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant self::U in /in/m1aZp:4 Stack trace: #0 /in/m1aZp(17): [constant expression]() #1 /in/m1aZp(17): ReflectionAttribute->getArguments() #2 {main} thrown in /in/m1aZp on line 4
Process exited with code 255.
Output for 8.2.0 - 8.2.18
Fatal error: Uncaught Error: Undefined constant self::U in /in/m1aZp:4 Stack trace: #0 /in/m1aZp(17): ReflectionAttribute->getArguments() #1 {main} thrown in /in/m1aZp on line 4
Process exited with code 255.
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught Error: Undefined constant self::U in /in/m1aZp:17 Stack trace: #0 /in/m1aZp(17): ReflectionAttribute->getArguments() #1 {main} thrown in /in/m1aZp on line 17
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/m1aZp:16 Stack trace: #0 {main} thrown in /in/m1aZp on line 16
Process exited with code 255.

preferences:
160.47 ms | 401 KiB | 121 Q