3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function foo(float $bar) { echo "This is private"; } public function getClosure($bar) { return function () use ($bar) { $this->foo($bar); }; } } class B extends A { public function test(A $a, C $c) { $aFN = $a->getClosure(42.5); $bFN = $this->getClosure(42.5); $cFN = $c->getClosure(42.5); $aFN(); $bFN(); $cFN(); } } class C extends B { public function foo(int $bar) { echo "This is public"; } public function getClosure($bar) { return function () use ($bar) { $this->foo($bar); }; } } $a = new A; $c = new c; $obj = new B(); $obj->test($a, $c);
Output for git.master, git.master_jit, rfc.property-hooks
This is privateThis is private Deprecated: Implicit conversion from float 42.5 to int loses precision in /in/1igd8 on line 26 This is public

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:
39.88 ms | 401 KiB | 8 Q