<?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()); } ?>
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`