3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class SomeAttr {} #[SomeAttr] class SomeClass { /** * Some comment */ #[SomeAttr] public function someMethod(string $someParam): void { } } $reflection = new ReflectionClass(SomeClass::class); echo (string) $reflection; echo (string) $reflection->getMethod('someMethod'); echo $reflection->getMethod('someMethod')->getAttributes()[0];
Output for git.master, git.master_jit, rfc.property-hooks
Class [ <user> class SomeClass ] { @@ /in/Ht9pi 7-16 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [1] { /** * Some comment */ Method [ <user> public method someMethod ] { @@ /in/Ht9pi 12 - 15 - Parameters [1] { Parameter #0 [ <required> string $someParam ] } - Return [ void ] } } } /** * Some comment */ Method [ <user> public method someMethod ] { @@ /in/Ht9pi 12 - 15 - Parameters [1] { Parameter #0 [ <required> string $someParam ] } - Return [ void ] } Attribute [ SomeAttr ]

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
121.89 ms | 407 KiB | 5 Q