3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[\Attribute(\Attribute::TARGET_PROPERTY)] final class AutowireProperty {} class A { #[AutowireProperty] protected string $foo; } class B extends A { } $fooA = new \ReflectionProperty(A::class, 'foo'); $fooB = new \ReflectionProperty(B::class, 'foo'); echo "Class A: "; var_export($fooA->getAttributes()[0]->getName()); echo "\n"; echo "Class B: "; var_export($fooA->getAttributes()[0]->getName()); echo "\n";

preferences:
27.64 ms | 404 KiB | 5 Q