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($reflection2); $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($reflection2)); echo PHP_EOL; } }
Output for git.master, git.master_jit, rfc.property-hooks
ReflectionFunction::__toString(): string(70) "Closure [ <user> static public method bar ] { @@ /in/2Y4oK 7 - 10 } " ReflectionFunction::isAnonymous(): bool(false) ReflectionFunction::isDisabled(): Deprecated: Method ReflectionFunction::isDisabled() is deprecated in /in/2Y4oK on line 24 bool(false) ReflectionFunction::getClosure(): object(Closure)#2 (1) { ["function"]=> string(19) "Name\Space\Foo::bar" } ReflectionFunction::inNamespace(): bool(false) ReflectionFunction::isClosure(): bool(true) ReflectionFunction::isDeprecated(): bool(false) ReflectionFunction::isInternal(): bool(false) ReflectionFunction::isUserDefined(): bool(true) ReflectionFunction::isGenerator(): bool(false) ReflectionFunction::isVariadic(): bool(false) ReflectionFunction::isStatic(): bool(true) ReflectionFunction::getClosureThis(): NULL ReflectionFunction::getClosureScopeClass(): object(ReflectionClass)#43 (1) { ["name"]=> string(14) "Name\Space\Foo" } ReflectionFunction::getClosureCalledClass(): object(ReflectionClass)#43 (1) { ["name"]=> string(14) "Name\Space\Foo" } ReflectionFunction::getClosureUsedVariables(): array(0) { } ReflectionFunction::getDocComment(): bool(false) ReflectionFunction::getEndLine(): int(10) ReflectionFunction::getExtension(): NULL ReflectionFunction::getExtensionName(): bool(false) ReflectionFunction::getFileName(): string(9) "/in/2Y4oK" ReflectionFunction::getName(): string(3) "bar" ReflectionFunction::getNamespaceName(): string(0) "" ReflectionFunction::getNumberOfParameters(): int(0) ReflectionFunction::getNumberOfRequiredParameters(): int(0) ReflectionFunction::getParameters(): array(0) { } ReflectionFunction::getShortName(): string(3) "bar" ReflectionFunction::getStartLine(): int(7) ReflectionFunction::getStaticVariables(): array(0) { } ReflectionFunction::returnsReference(): bool(false) ReflectionFunction::hasReturnType(): bool(false) ReflectionFunction::getReturnType(): NULL ReflectionFunction::hasTentativeReturnType(): bool(false) ReflectionFunction::getTentativeReturnType(): NULL

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.63 ms | 409 KiB | 8 Q