3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_group($cond, $arr) { if (empty($arr)) return []; $e = array_shift($arr); $g = [$e]; while($cond($e, reset($arr))) { $g[] = array_shift($arr); } return array_merge([$g], array_group($cond, $arr)); } function it($m,$p){echo ($p?'OK':'NO')." It $m\n";} function eq($a,$b) {return $a==$b;} echo it ('groups', array_group('eq', [1,5,5,6,6,6,7,9]) == [[1],[5,5],[6,6,6],[7],[9]]); echo it ('groups by comparing with first item of each group', array_group(function ($a, $b) { return ($a == ($b-1)) || ($a==$b); }, [1,1,2,3,1]) == [[1, 1, 2], [3], [1]]);

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.0030.01218.55
8.3.50.0130.01021.05
8.3.40.0100.00718.75
8.3.30.0040.01119.17
8.3.20.0040.00420.41
8.3.10.0040.00423.67
8.3.00.0090.00619.38
8.2.180.0110.00418.42
8.2.170.0090.00622.96
8.2.160.0070.00720.38
8.2.150.0030.00524.18
8.2.140.0090.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00022.10
8.2.110.0080.00020.56
8.2.100.0100.00018.03
8.2.90.0080.00019.20
8.2.80.0080.00017.97
8.2.70.0030.00617.72
8.2.60.0000.00817.93
8.2.50.0060.00318.07
8.2.40.0030.00719.95
8.2.30.0040.00418.06
8.2.20.0030.00517.92
8.2.10.0000.00818.01
8.2.00.0040.00417.89
8.1.280.0110.00425.92
8.1.270.0080.00022.14
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0000.01219.21
8.1.220.0030.00517.77
8.1.210.0000.00818.77
8.1.200.0030.00617.25
8.1.190.0040.00417.00
8.1.180.0000.00718.10
8.1.170.0000.00918.57
8.1.160.0000.00722.02
8.1.150.0040.00418.82
8.1.140.0050.00217.42
8.1.130.0070.00017.90
8.1.120.0040.00417.39
8.1.110.0000.00817.36
8.1.100.0040.00317.45
8.1.90.0040.00417.43
8.1.80.0040.00417.39
8.1.70.0000.00717.36
8.1.60.0000.00917.61
8.1.50.0070.00017.55
8.1.40.0000.00717.52
8.1.30.0080.00017.59
8.1.20.0000.00817.61
8.1.10.0030.00517.58
8.1.00.0030.00617.54
8.0.300.0050.00318.77
8.0.290.0000.00716.75
8.0.280.0030.00318.36
8.0.270.0000.00717.26
8.0.260.0000.00718.50
8.0.250.0000.00717.02
8.0.240.0040.00417.05
8.0.230.0030.00316.92
8.0.220.0000.00717.01
8.0.210.0060.00016.84
8.0.200.0000.00717.09
8.0.190.0040.00417.02
8.0.180.0000.00717.00
8.0.170.0020.00517.00
8.0.160.0000.00716.92
8.0.150.0000.00716.86
8.0.140.0000.00816.91
8.0.130.0000.00513.32
8.0.120.0030.00516.94
8.0.110.0040.00416.94
8.0.100.0070.00016.76
8.0.90.0040.00417.03
8.0.80.0040.01216.96
8.0.70.0050.00317.01
8.0.60.0070.00016.91
8.0.50.0080.00016.98
8.0.30.0130.01117.16
8.0.20.0110.00817.40
8.0.10.0040.00417.09
8.0.00.0060.01116.84
7.4.330.0000.00615.08
7.4.320.0030.00716.50
7.4.300.0060.00016.47
7.4.290.0030.00316.49
7.4.280.0050.00316.45
7.4.270.0040.00416.41
7.4.260.0000.00716.52
7.4.250.0050.00316.48
7.4.240.0040.00316.60
7.4.230.0060.00016.35
7.4.220.0070.01116.47
7.4.210.0040.01116.45
7.4.200.0030.00316.63
7.4.160.0060.01616.48
7.4.150.0060.01117.40
7.4.140.0180.01017.86
7.4.130.0100.00716.51
7.4.120.0100.00716.44
7.4.110.0040.01316.69
7.4.100.0130.00616.42
7.4.90.0130.00416.59
7.4.80.0050.01419.39
7.4.70.0110.00516.35
7.4.60.0100.00616.50
7.4.50.0000.00816.57
7.4.40.0130.00316.45
7.4.30.0170.00516.46
7.4.00.0030.01315.18
7.3.330.0000.00613.39
7.3.320.0050.00013.21
7.3.310.0030.00316.27
7.3.300.0070.00016.37
7.3.290.0090.01016.36
7.3.280.0080.00816.41
7.3.270.0110.00717.40
7.3.260.0090.00916.41
7.3.250.0090.00716.48
7.3.240.0130.01016.41
7.3.230.0090.01216.57
7.3.210.0090.00916.67
7.3.200.0070.01019.39
7.3.190.0110.00616.50
7.3.180.0110.00516.56
7.3.170.0070.01016.47
7.3.160.0090.00916.44
7.2.330.0090.00916.84
7.2.320.0090.00916.75
7.2.310.0080.01116.55
7.2.300.0090.00916.77
7.2.290.0040.01516.66
7.2.60.0110.00016.74
7.2.50.0080.00316.79
7.1.200.0070.00715.92
7.1.70.0040.00416.96
7.1.60.0100.01419.11
7.1.50.0070.01716.98
7.1.00.0000.08022.47
7.0.200.0000.00816.83
7.0.140.0000.07022.18
7.0.60.0070.06319.98
7.0.50.0070.03717.80
7.0.40.0130.08320.13
7.0.30.0200.08020.16
7.0.20.0270.03320.08
7.0.10.0030.04320.21
7.0.00.0130.06320.07
5.6.280.0070.07020.91
5.6.210.0170.06720.48
5.6.200.0070.04318.29
5.6.190.0070.06320.61
5.6.180.0300.07020.67
5.6.170.0170.04320.47
5.6.160.0000.04320.61
5.6.150.0100.06018.16
5.6.140.0030.04018.18
5.6.130.0030.06318.12
5.6.120.0130.03720.98
5.6.110.0170.07721.14
5.6.100.0100.07021.11
5.6.90.0200.07021.13
5.6.80.0100.07020.39
5.6.70.4800.04720.39
5.5.350.0130.08020.37
5.5.340.0030.08318.00
5.5.330.0000.06720.29
5.5.320.0270.05020.27
5.5.310.0200.04320.37
5.5.300.0070.06018.02
5.5.290.0000.04318.08
5.5.280.0070.05020.78
5.5.270.0100.08320.88
5.5.260.0070.07720.85
5.5.250.0000.08720.63
5.5.240.0300.07020.13
5.4.450.0770.05319.63
5.4.440.0930.06019.61
5.4.430.0600.06019.47
5.4.420.1000.06719.33
5.4.410.1030.06319.17
5.4.400.0770.05019.02
5.4.390.0630.06019.28
5.4.380.0370.05019.26
5.4.370.0800.05019.38
5.4.360.0970.08019.29
5.4.350.0770.04718.87
5.4.340.0070.03512.02
5.4.320.0070.03612.51
5.4.310.0080.03712.51
5.4.300.0040.04212.52
5.4.290.0050.04212.50
5.4.280.0120.05412.41
5.4.270.0080.03912.41
5.4.260.0080.04212.41
5.4.250.0060.04412.41
5.4.240.0050.04012.41
5.4.230.0080.03712.40
5.4.220.0010.04212.40
5.4.210.0050.04112.40
5.4.200.0060.03812.40
5.4.190.0070.03812.39
5.4.180.0050.04012.39
5.4.170.0090.03612.40
5.4.160.0070.03912.40
5.4.150.0090.03712.39
5.4.140.0170.04812.08
5.4.130.0150.03912.07
5.4.120.0090.03812.02
5.4.110.0040.04312.02
5.4.100.0090.03612.02
5.4.90.0060.04012.02
5.4.80.0070.03812.02
5.4.70.0070.03612.02
5.4.60.0060.03712.02
5.4.50.0040.03912.01
5.4.40.0040.03912.00
5.4.30.0080.03812.00
5.4.20.0090.04912.00
5.4.10.0040.04012.00
5.4.00.0050.04711.50
5.3.290.0110.03912.80
5.3.280.0140.06012.71
5.3.270.0070.05512.73
5.3.260.0070.05612.72
5.3.250.0080.04012.71
5.3.240.0140.04712.72
5.3.230.0130.04512.70
5.3.220.0060.04812.68
5.3.210.0150.04812.68
5.3.200.0070.03912.68
5.3.190.0070.04512.68
5.3.180.0080.04012.67
5.3.170.0080.05012.67
5.3.160.0090.04912.68
5.3.150.0130.04612.67
5.3.140.0090.05012.66
5.3.130.0090.05212.66
5.3.120.0080.05512.66
5.3.110.0120.04812.66
5.3.100.0040.05012.13
5.3.90.0100.04912.11
5.3.80.0060.03812.09
5.3.70.0080.03912.09
5.3.60.0050.04012.08
5.3.50.0100.03612.02
5.3.40.0090.04912.02
5.3.30.0070.05011.98
5.3.20.0110.03611.77
5.3.10.0090.03511.74
5.3.00.0090.04011.72
5.2.170.0080.0409.22
5.2.160.0100.0359.21
5.2.150.0080.0309.21
5.2.140.0060.0379.21
5.2.130.0060.0329.17
5.2.120.0060.0299.18
5.2.110.0080.0279.18
5.2.100.0040.0319.18
5.2.90.0040.0389.18
5.2.80.0050.0329.17
5.2.70.0070.0309.18
5.2.60.0060.0299.13
5.2.50.0060.0319.09
5.2.40.0090.0349.07
5.2.30.0060.0319.05
5.2.20.0050.0399.05
5.2.10.0060.0378.95
5.2.00.0050.0418.80
5.1.60.0020.0358.08
5.1.50.0040.0268.09
5.1.40.0040.0278.07
5.1.30.0050.0258.42
5.1.20.0060.0258.44
5.1.10.0030.0298.16
5.1.00.0070.0258.16
5.0.50.0040.0206.64
5.0.40.0050.0176.50
5.0.30.0030.0326.31
5.0.20.0020.0206.29
5.0.10.0040.0196.26
5.0.00.0020.0326.25
4.4.90.0040.0144.77
4.4.80.0030.0154.75
4.4.70.0050.0144.76
4.4.60.0030.0154.75
4.4.50.0020.0164.77
4.4.40.0020.0264.71
4.4.30.0020.0164.76
4.4.20.0030.0154.84
4.4.10.0070.0194.85
4.4.00.0050.0274.76
4.3.110.0040.0234.67
4.3.100.0080.0174.66
4.3.90.0040.0134.63
4.3.80.0040.0264.58
4.3.70.0060.0144.63
4.3.60.0040.0134.63
4.3.50.0030.0154.63
4.3.40.0020.0254.54
4.3.30.0000.0193.30
4.3.20.0010.0173.28
4.3.10.0050.0153.24
4.3.00.0000.0237.02

preferences:
63.08 ms | 401 KiB | 5 Q