3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[Attribute] class SomeAttr {} /** * Class comment */ #[SomeAttr] class SomeClass { /** * Property comment */ #[SomeAttr] private string $someProperty; /** * Method comment */ #[SomeAttr] public function someMethod(string $someParam): void { } } $reflection = new ReflectionClass(SomeClass::class); echo (string) $reflection; echo (string) $reflection->getMethod('someMethod'); echo (string) $reflection->getProperty('someProperty'); echo $reflection->getMethod('someMethod')->getAttributes()[0];
Output for git.master, git.master_jit, rfc.property-hooks
/** * Class comment */ Class [ <user> class SomeClass ] { @@ /in/U1vT0 10-26 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [1] { Property [ private string $someProperty ] } - Methods [1] { /** * Method comment */ Method [ <user> public method someMethod ] { @@ /in/U1vT0 22 - 25 - Parameters [1] { Parameter #0 [ <required> string $someParam ] } - Return [ void ] } } } /** * Method comment */ Method [ <user> public method someMethod ] { @@ /in/U1vT0 22 - 25 - Parameters [1] { Parameter #0 [ <required> string $someParam ] } - Return [ void ] } Property [ private string $someProperty ] 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:
50.83 ms | 403 KiB | 8 Q