3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function F() { return "A"; } } $c = (function() { var_dump(static::F()); })->bindTo(new A, NULL); var_dump((new \ReflectionFunction($c))->getClosureScopeClass()->name); $c(); $c = (function() { var_dump(self::F()); })->bindTo(new A, "A"); var_dump((new \ReflectionFunction($c))->getClosureScopeClass()->name); $c(); $c = (function() { var_dump(self::F()); })->bindTo(new A, NULL); var_dump((new \ReflectionFunction($c))->getClosureScopeClass()->name); $c();
Output for git.master, git.master_jit, rfc.property-hooks
string(7) "Closure" string(1) "A" string(1) "A" string(1) "A" string(7) "Closure" Fatal error: Uncaught Error: Call to undefined method Closure::F() in /in/SuAuh:13 Stack trace: #0 /in/SuAuh(15): Closure->{closure}() #1 {main} thrown in /in/SuAuh on line 13
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:
124.57 ms | 406 KiB | 5 Q