3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] class FooAttribute { function __construct(public string $value) {} } #[FooAttribute('a')] #[FooAttribute('b')] class Foo {} var_dump( array_map( fn ($ar) => $ar->newInstance(), (new ReflectionClass(Foo::class))->getAttributes(FooAttribute::class) ) );

preferences:
49.91 ms | 402 KiB | 5 Q