3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[ReturnTypeWillChange] class XXX { } $reflection = (new ReflectionClass(XXX::class)); var_dump( $reflection->getAttributes()[0]->newInstance() ); ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Attribute "ReturnTypeWillChange" cannot target class (allowed targets: method) in /in/5gjNF on line 4
Process exited with code 255.
Output for 8.0.1 - 8.0.30
Fatal error: Uncaught Error: Attribute class "ReturnTypeWillChange" not found in /in/5gjNF:10 Stack trace: #0 /in/5gjNF(10): ReflectionAttribute->newInstance() #1 {main} thrown in /in/5gjNF on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Call to undefined method ReflectionClass::getAttributes() in /in/5gjNF:10 Stack trace: #0 {main} thrown in /in/5gjNF on line 10
Process exited with code 255.

preferences:
141.8 ms | 401 KiB | 121 Q