3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class y { function foo() { return __METHOD__; } } #[X, Y] function f() { } $ref = new \ReflectionFunction('\f'); try { if ($ref->getAttributes()[0]->getName() === 'X') { print 'Look mom! No hands' . PHP_EOL; } if ($ref->getAttributes()[1]->getName() === 'Y') { print $ref->getAttributes()[1]->newInstance()->foo(); } } catch (\Error $e) { # other errors var_dump($e->getMessage()); } ?>

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
148.96 ms | 1466 KiB | 9 Q