3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $a; public function __construct($a) { $this->a = (int) $a; } public static function extractA(self $aFoo) { return $aFoo->a; } } function max_by(array $aList, callable $aCallback) { return array_reduce($aList, function($carry, $item) use ($aCallback) { return ($carry == null || $aCallback($item) > $aCallback($carry)) ? $item : $carry; }) } $list = [ $foo1 = new Foo(2), $foo2 = new Foo(5), $foo3 = new Foo(1), ]; assert(max_by($list, ['Foo', 'extractA']) === $foo2);

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)
5.4.350.0090.03212.04
5.4.340.0130.03712.04
5.4.320.0110.04712.52
5.4.310.0110.04812.52
5.4.300.0120.03912.53
5.4.290.0070.04612.52
5.4.280.0060.03712.42
5.4.270.0060.03812.42
5.4.260.0070.03912.42
5.4.250.0060.04412.42
5.4.240.0100.04612.42
5.4.230.0080.05312.41
5.4.220.0040.04212.41
5.4.210.0090.03612.41
5.4.200.0070.03712.41
5.4.190.0070.03712.41
5.4.180.0100.04012.41
5.4.170.0100.03712.41
5.4.160.0090.04412.41
5.4.150.0110.03812.41
5.4.140.0090.03912.09
5.4.130.0070.03812.07
5.4.120.0090.04012.05
5.4.110.0060.03912.04
5.4.100.0050.03612.04
5.4.90.0070.03812.04
5.4.80.0080.03612.04
5.4.70.0090.03912.04
5.4.60.0040.03712.04
5.4.50.0060.03712.04
5.4.40.0070.04012.02
5.4.30.0130.05312.02
5.4.20.0060.04312.01
5.4.10.0050.04012.02
5.4.00.0050.05311.51
5.3.290.0080.04812.80
5.3.280.0090.04412.70
5.3.270.0070.04512.72
5.3.260.0050.04212.71
5.3.250.0080.03812.71
5.3.240.0050.04112.72
5.3.230.0080.03712.71
5.3.220.0080.03912.68
5.3.210.0070.05012.68
5.3.200.0060.04212.68
5.3.190.0090.03412.68
5.3.180.0120.03912.67
5.3.170.0090.03812.67
5.3.160.0130.03612.67
5.3.150.0120.04612.68
5.3.140.0090.05112.66
5.3.130.0090.05312.65
5.3.120.0110.05112.66
5.3.110.0070.05312.66
5.3.100.0100.04312.13
5.3.90.0090.04612.12
5.3.80.0090.04712.10
5.3.70.0100.04512.11
5.3.60.0090.04512.09
5.3.50.0100.04412.04
5.3.40.0100.04512.04
5.3.30.0140.04112.00
5.3.20.0030.03711.77
5.3.10.0100.03611.74
5.3.00.0050.04011.73
5.2.170.0050.0359.22
5.2.160.0080.0289.23
5.2.150.0060.0319.22
5.2.140.0050.0379.21
5.2.130.0080.0389.18
5.2.120.0100.0369.18
5.2.110.0080.0379.20
5.2.100.0080.0329.19
5.2.90.0090.0309.19
5.2.80.0060.0349.18
5.2.70.0060.0329.18
5.2.60.0080.0489.13
5.2.50.0060.0449.10
5.2.40.0070.0369.07
5.2.30.0090.0399.06
5.2.20.0060.0389.05
5.2.10.0070.0358.95
5.2.00.0050.0408.81
5.1.60.0060.0328.09
5.1.50.0070.0318.09
5.1.40.0060.0328.07
5.1.30.0090.0328.43
5.1.20.0060.0348.45
5.1.10.0090.0308.17
5.1.00.0070.0348.17
5.0.50.0070.0246.65
5.0.40.0030.0286.51
5.0.30.0070.0376.32
5.0.20.0050.0246.29
5.0.10.0060.0256.27
5.0.00.0050.0376.26
4.4.90.0040.0214.77
4.4.80.0020.0224.75
4.4.70.0030.0214.76
4.4.60.0020.0224.75
4.4.50.0020.0234.77
4.4.40.0020.0334.70
4.4.30.0030.0214.76
4.4.20.0050.0204.84
4.4.10.0030.0224.85
4.4.00.0030.0324.76
4.3.110.0040.0214.67
4.3.100.0040.0174.67
4.3.90.0010.0164.63
4.3.80.0030.0254.59
4.3.70.0010.0164.63
4.3.60.0040.0134.62
4.3.50.0020.0174.63
4.3.40.0040.0234.54
4.3.30.0040.0153.30
4.3.20.0030.0153.28
4.3.10.0050.0173.23
4.3.00.0070.01713.47

preferences:
145.75 ms | 1394 KiB | 7 Q