3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function foo(int $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("Hello"); $bFN = $this->getClosure("Hello"); $cFN = $c->getClosure("Hello"); $aFN(); $cFN(); } } class C extends B { public function foo(bool $bar) { echo "This is public"; } public function getClosure($bar) { return function () use ($bar) { $this->foo($bar)}; } } $a = new A; $c = new B; $obj = new B(); $obj->test($a, $c);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.00.0130.05720.07
5.6.160.0070.08720.52
5.6.150.0000.04018.18
5.6.140.0100.06318.21
5.6.130.0030.06018.14
5.6.120.0000.04321.00
5.6.110.0070.08321.01
5.6.100.0030.08721.10
5.6.90.0070.08320.98
5.6.80.0070.04320.54
5.5.300.0100.06717.95
5.5.290.0030.07318.08
5.5.280.0100.07320.88
5.5.270.0100.03320.77
5.5.260.0100.07720.85
5.5.250.0070.04320.59
5.5.240.0170.02720.15

preferences:
134.46 ms | 1398 KiB | 7 Q