3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute(Attribute::TARGET_FUNCTION)] class Test {} class Foo { #[Test] public int $test; } echo "Creating foo: "; $f = new Foo(); echo "done\n"; echo "Performing reflection: "; $foo = new ReflectionClass($f); $test = $foo->getProperty('test'); $attributes = $test->getAttributes(); echo "done\n"; echo "instantiating attribute ["; foreach ($attributes as $attribute) { echo $attribute->getName() . ']: '; $attribute->newInstance(); } echo "\n";

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
147.45 ms | 1480 KiB | 8 Q