3v4l.org

run code in 300+ PHP versions simultaneously
<?php // test data class Foo { private $a; private $b; function __construct($a, $b) { $this->a = $a; $this->b = $b; } public function getA() { return $this->a; } public function getB() { return $this->b; } } $list = [ $foo1 = new Foo(2, "bar"), $foo2 = new Foo(5, "baz"), $foo3 = new Foo(1, "bam"), ]; // simple $isGreater = function($carry, $item) { return is_null($carry) || $item->getA() > $carry->getA() ? $item : $carry; }; $maxOfList = array_reduce($list, $isGreater); assert($maxOfList === $foo2); // reusable max() function $max = function($list, callable $extract) { $compare = function($carry, $item) use($extract) { return is_null($carry) || $extract($item) > $extract($carry) ? $item : $carry; }; return array_reduce($list, $compare); }; $extractA = function($x) { return $x->getA();}; assert($max($list, $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)
8.3.60.0180.00016.75
8.3.50.0050.01422.98
8.3.40.0110.00718.82
8.3.30.0040.01119.22
8.3.20.0000.00720.29
8.3.10.0040.00420.52
8.3.00.0040.00419.19
8.2.180.0060.00918.34
8.2.170.0060.00922.96
8.2.160.0100.00320.22
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00726.16
8.2.120.0050.00319.36
8.2.110.0060.00320.52
8.2.100.0090.00317.87
8.2.90.0000.00819.20
8.2.80.0000.00919.28
8.2.70.0060.00317.63
8.2.60.0050.00318.04
8.2.50.0000.00918.07
8.2.40.0030.00618.22
8.2.30.0070.00021.28
8.2.20.0050.00317.69
8.2.10.0000.00818.11
8.2.00.0000.00817.82
8.1.280.0150.00625.92
8.1.270.0060.00323.79
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0030.00623.92
8.1.230.0040.00720.91
8.1.220.0040.00418.77
8.1.210.0080.00018.95
8.1.200.0030.00617.35
8.1.190.0080.00017.53
8.1.180.0040.00418.10
8.1.170.0000.00818.63
8.1.160.0070.00018.88
8.1.150.0000.00718.83
8.1.140.0040.00417.53
8.1.130.0000.00717.78
8.1.120.0000.00717.42
8.1.110.0040.00417.46
8.1.100.0040.00317.54
8.1.90.0040.00417.38
8.1.80.0030.00317.50
8.1.70.0020.00517.45
8.1.60.0000.00817.63
8.1.50.0000.00817.47
8.1.40.0040.00417.54
8.1.30.0000.00817.67
8.1.20.0060.00317.64
8.1.10.0000.00717.54
8.1.00.0000.00817.42
8.0.300.0070.00019.80
8.0.290.0000.00717.05
8.0.280.0000.00718.33
8.0.270.0050.00217.27
8.0.260.0030.00317.33
8.0.250.0030.00517.02
8.0.240.0040.00417.05
8.0.230.0020.00517.03
8.0.220.0060.00316.84
8.0.210.0070.00016.95
8.0.200.0060.00017.00
8.0.190.0040.00416.93
8.0.180.0000.00716.99
8.0.170.0030.00516.88
8.0.160.0050.00316.97
8.0.150.0030.00616.93
8.0.140.0030.00316.93
8.0.130.0000.00713.41
8.0.120.0040.00416.88
8.0.110.0030.00516.96
8.0.100.0070.00016.88
8.0.90.0070.00016.90
8.0.80.0070.01316.85
8.0.70.0040.00417.07
8.0.60.0000.00717.00
8.0.50.0030.00516.86
8.0.30.0100.01317.05
8.0.20.0140.00717.40
8.0.10.0000.00717.20
8.0.00.0060.01116.76
7.4.330.0020.00315.04
7.4.320.0000.00616.62
7.4.300.0070.00016.41
7.4.290.0000.00716.53
7.4.280.0050.00216.49
7.4.270.0070.00016.44
7.4.260.0070.00016.59
7.4.250.0000.00816.47
7.4.240.0010.00716.61
7.4.230.0070.00016.45
7.4.220.0130.00516.68
7.4.210.0130.00616.63
7.4.200.0070.00016.31
7.4.160.0030.01316.58
7.4.150.0110.00617.40
7.4.140.0060.01117.86
7.4.130.0110.01016.51
7.4.120.0080.01216.57
7.4.110.0130.01016.64
7.4.100.0100.00716.66
7.4.90.0070.01116.61
7.4.80.0140.00419.39
7.4.70.0100.00716.58
7.4.60.0080.00816.33
7.4.50.0030.00616.46
7.4.40.0070.01516.56
7.4.30.0100.00616.72
7.4.00.0060.00815.19
7.3.330.0030.00313.26
7.3.320.0000.00513.44
7.3.310.0040.00416.53
7.3.300.0030.00316.45
7.3.290.0080.00716.45
7.3.280.0130.00416.40
7.3.270.0060.01217.40
7.3.260.0070.01016.62
7.3.250.0080.01216.40
7.3.240.0070.01016.40
7.3.230.0090.00916.66
7.3.210.0030.01416.43
7.3.200.0140.00316.52
7.3.190.0090.01016.48
7.3.180.0070.00716.50
7.3.170.0170.00016.46
7.3.160.0040.01116.48
7.3.120.0100.00314.71
7.3.110.0100.00714.48
7.3.100.0080.00814.52
7.3.90.0040.00814.84
7.3.80.0090.00914.56
7.3.70.0040.00714.94
7.3.60.0100.00314.89
7.3.50.0030.01014.61
7.3.40.0030.00914.92
7.3.30.0000.01214.96
7.3.20.0070.00716.88
7.3.10.0040.01116.39
7.3.00.0030.00916.71
7.2.330.0090.00916.70
7.2.320.0070.01016.53
7.2.310.0120.00816.78
7.2.300.0030.01416.73
7.2.290.0040.01516.64
7.2.250.0160.00315.08
7.2.240.0080.01115.08
7.2.230.0100.00715.08
7.2.220.0030.00915.22
7.2.210.0100.00714.92
7.2.200.0000.01315.17
7.2.190.0000.01415.10
7.2.180.0070.00714.94
7.2.170.0100.00315.13
7.2.160.0070.00715.09
7.2.150.0040.00816.82
7.2.140.0030.01017.11
7.2.130.0120.00316.92
7.2.120.0000.01016.93
7.2.110.0080.00617.16
7.2.100.0110.00416.96
7.2.90.0040.01117.03
7.2.80.0090.00616.71
7.2.70.0000.01517.06
7.2.60.0030.01417.02
7.2.50.0080.00416.86
7.2.40.0110.00417.20
7.2.30.0040.01117.02
7.2.20.0030.00717.01
7.2.10.0040.00817.08
7.2.00.0080.00618.21
7.1.330.0080.00615.71
7.1.320.0090.00616.07
7.1.310.0040.00715.92
7.1.300.0110.00415.71
7.1.290.0100.00315.74
7.1.280.0040.00816.00
7.1.270.0100.00315.89
7.1.260.0060.00315.84
7.1.250.0100.00315.98
7.1.240.0000.01115.79
7.1.230.0100.00315.70
7.1.220.0000.01315.78
7.1.210.0030.01015.91
7.1.200.0070.01015.85
7.1.190.0060.01215.92
7.1.180.0070.01016.02
7.1.170.0090.00315.69
7.1.160.0030.00615.89
7.1.150.0070.01015.86
7.1.140.0060.00915.57
7.1.130.0060.00315.75
7.1.120.0030.01215.80
7.1.110.0030.01515.88
7.1.100.0040.00716.73
7.1.90.0030.00616.03
7.1.80.0030.00915.61
7.1.70.0070.00816.46
7.1.60.0060.00516.50
7.1.50.0060.00916.44
7.1.40.0070.00715.78
7.1.30.0040.01115.95
7.1.20.0070.01015.68
7.1.10.0060.00615.52
7.1.00.0050.04419.13
7.0.330.0040.00415.30
7.0.320.0030.01015.39
7.0.310.0030.00915.42
7.0.300.0120.00015.48
7.0.290.0040.01215.40
7.0.280.0000.01115.53
7.0.270.0030.00915.59
7.0.260.0040.01115.64
7.0.250.0090.00915.31
7.0.240.0070.00715.51
7.0.230.0030.00915.60
7.0.220.0100.00315.45
7.0.210.0090.00415.30
7.0.200.0030.00716.06
7.0.190.0070.00715.38
7.0.180.0060.01015.48
7.0.170.0030.01015.51
7.0.160.0060.00315.25
7.0.150.0130.00015.68
7.0.140.0050.02418.71
7.0.130.0050.00515.45
7.0.120.0080.00815.49
7.0.110.0040.00715.39
7.0.100.0050.00515.27
7.0.90.0060.00615.31
7.0.80.0070.01115.50
7.0.70.0100.00715.40
7.0.60.0070.04017.78
7.0.50.0020.02616.61
7.0.40.0060.02516.87
7.0.30.0250.03316.76
7.0.20.0220.03016.84
7.0.10.0080.02416.86
7.0.00.0080.04216.91
5.6.400.0030.01014.72
5.6.390.0040.00714.06
5.6.380.0070.00314.28
5.6.370.0060.01114.62
5.6.360.0110.00314.36
5.6.350.0070.00514.09
5.6.340.0000.01214.36
5.6.330.0040.01114.68
5.6.320.0030.01314.70
5.6.310.0070.01014.06
5.6.300.0060.00314.33
5.6.290.0100.00014.59
5.6.280.0000.04517.75
5.6.270.0000.01514.39
5.6.260.0060.00614.04
5.6.250.0120.00014.27
5.6.240.0090.00414.34
5.6.230.0090.00914.54
5.6.220.0040.00714.64
5.6.210.0080.04417.49
5.6.200.0100.03316.29
5.6.190.0070.02217.57
5.6.180.0170.02517.44
5.6.170.0200.04117.33
5.6.160.0020.02717.41
5.6.150.0080.03516.36
5.6.140.0080.03616.34
5.6.130.0030.03716.32
5.6.120.0020.03017.69
5.6.110.0110.03017.67
5.6.100.0050.04317.73
5.6.90.0020.04417.61
5.6.80.0100.03817.48
5.6.70.2140.02217.41
5.6.60.0080.00414.48
5.6.50.0030.00614.12
5.6.40.0030.00914.25
5.6.30.0030.01014.36
5.6.20.0070.00714.56
5.6.10.0100.00314.28
5.6.00.0030.00514.20
5.5.380.0040.01414.08
5.5.370.0090.00914.25
5.5.360.0040.00414.07
5.5.350.0040.04717.38
5.5.340.0100.01916.17
5.5.330.0040.03117.27
5.5.320.0130.04017.29
5.5.310.0150.03017.28
5.5.300.0060.03316.26
5.5.290.0070.04816.28
5.5.280.0090.03417.80
5.5.270.0050.04217.47
5.5.260.0050.03417.71
5.5.250.0110.04117.49
5.5.240.0020.01917.22
5.5.230.0030.00714.63
5.5.220.0040.00714.19
5.5.210.0030.00914.40
5.5.200.0030.00914.65
5.5.190.0000.01114.30
5.5.180.0050.00514.15
5.5.170.0000.01014.39
5.5.160.0030.01014.38
5.5.150.0120.00014.26
5.5.140.0060.00614.14
5.5.130.0000.00914.32
5.5.120.0000.01114.33
5.5.110.0060.00314.24
5.5.100.0080.00614.06
5.5.90.0090.00614.41
5.5.80.0030.00914.21
5.5.70.0060.00614.47
5.5.60.0070.00314.01
5.5.50.0040.01114.40
5.5.40.0090.00614.34
5.5.30.0060.00914.06
5.5.20.0070.00714.47
5.5.10.0090.00314.35
5.5.00.0090.00614.30
5.4.450.0250.02716.33
5.4.440.0330.02016.20
5.4.430.0230.02816.35
5.4.420.0100.02616.22
5.4.410.0050.03116.33
5.4.400.0090.03016.18
5.4.390.0040.03716.19
5.4.380.0070.03016.07
5.4.370.0080.03016.07
5.4.360.0120.02316.11
5.4.350.0060.02112.58
5.4.340.0070.02012.58
5.4.330.0030.00613.13
5.4.320.0080.02012.82
5.4.310.0060.03312.82
5.4.300.0070.02412.82
5.4.290.0040.02312.82
5.4.280.0020.02212.77
5.4.270.0070.02212.77
5.4.260.0060.02212.77
5.4.250.0060.02312.77
5.4.240.0040.02712.77
5.4.230.0070.02012.77
5.4.220.0020.02212.77
5.4.210.0040.02412.77
5.4.200.0060.02312.77
5.4.190.0090.02112.76
5.4.180.0020.03612.77
5.4.170.0050.02512.77
5.4.160.0070.02612.77
5.4.150.0070.02512.77
5.4.140.0070.02512.61
5.4.130.0070.02712.60
5.4.120.0060.02812.58
5.4.110.0070.02412.58
5.4.100.0050.02212.58
5.4.90.0060.02412.58
5.4.80.0060.02412.58
5.4.70.0080.02112.58
5.4.60.0070.02412.58
5.4.50.0040.02612.58
5.4.40.0050.02112.57
5.4.30.0050.02512.57
5.4.20.0080.02112.57
5.4.10.0040.02212.57
5.4.00.0060.02212.31
5.3.290.0080.03712.80
5.3.280.0050.04312.70
5.3.270.0100.03812.72
5.3.260.0090.04612.72
5.3.250.0070.05112.71
5.3.240.0120.04712.72
5.3.230.0040.04012.71
5.3.220.0110.03312.68
5.3.210.0060.04112.68
5.3.200.0090.03512.68
5.3.190.0130.03612.68
5.3.180.0080.04112.68
5.3.170.0060.05212.67
5.3.160.0070.04812.67
5.3.150.0070.04712.67
5.3.140.0030.04312.66
5.3.130.0050.04112.66
5.3.120.0070.04112.66
5.3.110.0090.03912.66
5.3.100.0100.03812.12
5.3.90.0100.03812.11
5.3.80.0050.03912.10
5.3.70.0070.03812.09
5.3.60.0080.04112.09
5.3.50.0110.03112.04
5.3.40.0070.03612.03
5.3.30.0070.03811.99
5.3.20.0080.03511.77
5.3.10.0090.03411.73
5.3.00.0050.03811.72
5.2.170.0060.0439.23
5.2.160.0080.0319.22
5.2.150.0080.0319.23
5.2.140.0070.0329.22
5.2.130.0100.0309.18
5.2.120.0050.0319.18
5.2.110.0070.0309.19
5.2.100.0070.0329.19
5.2.90.0070.0319.19
5.2.80.0060.0329.19
5.2.70.0080.0389.18
5.2.60.0070.0429.13
5.2.50.0060.0349.10
5.2.40.0080.0339.07
5.2.30.0070.0399.06
5.2.20.0090.0289.05
5.2.10.0060.0318.95
5.2.00.0090.0338.82
5.1.60.0120.0388.09
5.1.50.0090.0248.09
5.1.40.0090.0288.07
5.1.30.0060.0328.43
5.1.20.0100.0318.44
5.1.10.0060.0258.17
5.1.00.0040.0268.17
5.0.50.0080.0176.65
5.0.40.0030.0206.51
5.0.30.0030.0326.32
5.0.20.0030.0216.29
5.0.10.0040.0196.27
5.0.00.0070.0286.26
4.4.90.0030.0174.78
4.4.80.0030.0184.75
4.4.70.0040.0154.75
4.4.60.0020.0194.75
4.4.50.0030.0194.77
4.4.40.0030.0284.70
4.4.30.0020.0174.76
4.4.20.0050.0144.84
4.4.10.0040.0164.84
4.4.00.0040.0244.76
4.3.110.0030.0164.67
4.3.100.0040.0154.66
4.3.90.0050.0134.63
4.3.80.0030.0274.58
4.3.70.0050.0134.63
4.3.60.0040.0134.63
4.3.50.0020.0194.63
4.3.40.0060.0334.54
4.3.30.0030.0213.30
4.3.20.0020.0183.30
4.3.10.0030.0173.30
4.3.00.0100.01313.38

preferences:
55.9 ms | 401 KiB | 5 Q