3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function foo() { echo "I R private::A called in class ".get_class()."\n"; } public function rebind(Closure $fn) { //$fn = $this->getClosure(); $fn2 = $fn->call($this); $fn2(); } public function getClosure() { $fn = function() { $this->foo();}; return $fn; } } class B extends A { private function foo() { echo "I R private::B called in class ".get_class()."\n"; } public function getClosure() { $fn = function() { $this->foo();}; return $fn; } } $b = new B(); $fn = $b->getClosure(); $a = new A(); $a->rebind($fn);
Output for git.master, git.master_jit, rfc.property-hooks
I R private::A called in class A Fatal error: Uncaught Error: Value of type null is not callable in /in/FVmY0:15 Stack trace: #0 /in/FVmY0(47): A->rebind(Object(Closure)) #1 {main} thrown in /in/FVmY0 on line 15
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:
54.05 ms | 401 KiB | 8 Q