3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class ParentAttribute { } class ParentClass { #[ParentAttribute] protected $foo; } #[Attribute] class ChildAttribute { } class ChildClass extends ParentClass { #[ChildAttribute] protected $foo; } $rp = new ReflectionProperty(ChildClass::class, "foo"); foreach ($rp->getAttributes() as $attribute) { print_r($attribute->getName()); }

preferences:
23.3 ms | 404 KiB | 5 Q