3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Name\Space; class Foo { public static function bar() { } } $reflection = new \ReflectionMethod('Name\\Space\\Foo', 'bar'); $closure = $reflection->getClosure(null); $reflection2 = new \ReflectionFunction($closure); echo PHP_EOL; echo PHP_EOL; $ReflectionClass = get_class($reflection); $ReflectionCeption = new \ReflectionClass($ReflectionClass); foreach ($ReflectionCeption->getMethods(\ReflectionMethod::IS_PUBLIC) as $Method) { if(!$Method->isStatic() && $Method->getNumberOfParameters() === 0) { echo sprintf('%s::%s(): ', $ReflectionClass, $Method->name); var_dump($Method->invoke($reflection)); echo PHP_EOL; } }
Output for git.master, git.master_jit, rfc.property-hooks
ReflectionMethod::__toString(): string(69) "Method [ <user> static public method bar ] { @@ /in/V6HCV 7 - 10 } " ReflectionMethod::isPublic(): bool(true) ReflectionMethod::isPrivate(): bool(false) ReflectionMethod::isProtected(): bool(false) ReflectionMethod::isAbstract(): bool(false) ReflectionMethod::isFinal(): bool(false) ReflectionMethod::isConstructor(): bool(false) ReflectionMethod::isDestructor(): bool(false) ReflectionMethod::getModifiers(): int(17) ReflectionMethod::getDeclaringClass(): object(ReflectionClass)#53 (1) { ["name"]=> string(14) "Name\Space\Foo" } ReflectionMethod::getPrototype(): Fatal error: Uncaught ReflectionException: Method Name\Space\Foo::bar does not have a prototype in /in/V6HCV:24 Stack trace: #0 [internal function]: ReflectionMethod->getPrototype() #1 /in/V6HCV(24): ReflectionMethod->invoke(Object(ReflectionMethod)) #2 {main} thrown in /in/V6HCV on line 24
Process exited with code 255.

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:
52.98 ms | 402 KiB | 8 Q