3v4l.org

run code in 300+ PHP versions simultaneously
<?php function group($cond, $arr) { if (!$arr) return []; $e = array_shift($arr); $g = [$e]; while($cond($e, reset($arr))) { $g[] = array_shift($arr); } return array_merge([$g], group($cond, $arr)); } function it($m,$p){echo ($p?'OK':'NO')." It $m\n";} function eq($a,$b) {return $a==$b;} //echo it ('groups', group('eq', [1,5,5,6,6,6,7,9]) == [[1],[5,5],[6,6,6],[7],[9]]); it('spans elements which match', group(function ($x) { return $x < 3; }, [1, 2, 3]) === [[1, 2], [3]]); it('spans elements which match from the start', group(function ($x) { return $x == 3; }, [1, 6, 3, 3]) === [[], [1, 2, 3, 3]]); it('spans returns empty lists on empty list', group(function ($x) { return false; }, []) === [[], []]); it('groups elements recursively', array_group(function ($a, $b) { return $a === $b; }, [1, 1, 2, 1]) === [[1, 1], [2], [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.0370.25550.49
8.3.50.0640.23949.92
8.3.40.0230.14335.77
8.3.30.0340.10836.10
8.3.20.0200.05337.13
8.3.10.0030.06539.74
8.3.00.0030.05737.43
8.2.180.0560.19650.48
8.2.170.0340.09736.00
8.2.160.0370.09537.49
8.2.150.0230.06836.20
8.2.140.0170.05535.88
8.2.130.0130.05738.35
8.2.120.0100.05938.21
8.2.110.0130.13237.48
8.2.100.0270.08035.20
8.2.90.0140.08536.30
8.2.80.0030.08834.74
8.2.70.0100.08034.65
8.2.60.0100.08035.02
8.2.50.0170.08034.51
8.2.40.0200.07335.45
8.2.30.0230.07635.16
8.2.20.0140.08534.86
8.2.10.0130.09435.17
8.2.00.0130.08634.93
8.1.280.0560.11649.23
8.1.270.0230.02939.99
8.1.260.0160.02536.97
8.1.250.0130.04039.25
8.1.240.0070.05142.02
8.1.230.0200.04136.09
8.1.220.0130.04334.73
8.1.210.0130.04334.41
8.1.200.0170.04034.37
8.1.190.0130.04234.32
8.1.180.0140.04134.67
8.1.170.0180.05035.31
8.1.160.0070.05139.19
8.1.150.0200.04035.89
8.1.140.0100.05334.57
8.1.130.0100.04334.84
8.1.120.0170.04134.61
8.1.110.0060.05434.48
8.1.100.0130.04634.54
8.1.90.0210.03834.55
8.1.80.0130.04234.63
8.1.70.0100.04834.52
8.1.60.0140.04834.69
8.1.50.0170.04734.70
8.1.40.0130.04934.52
8.1.30.0140.04834.72
8.1.20.0200.04234.72
8.1.10.0230.09250.58
8.1.00.0230.09350.51
8.0.300.0170.09750.26
8.0.290.0100.10549.86
8.0.280.0270.08751.41
8.0.270.0330.08550.28
8.0.260.0200.09950.29
8.0.250.0230.09349.98
8.0.240.0260.08849.89
8.0.230.0130.09949.81
8.0.220.0170.10149.71
8.0.210.0200.09049.82
8.0.200.0170.09749.95
8.0.190.0200.09649.76
8.0.180.0230.09349.91
8.0.170.0270.09149.96
8.0.160.0270.08849.87
8.0.150.0200.09449.73
8.0.140.0170.10149.71
8.0.130.0330.20078.34
8.0.120.0230.09849.79
8.0.110.0170.10649.71
8.0.100.0260.08849.77
8.0.90.0300.08749.88
8.0.80.0780.22849.88
8.0.70.0300.08649.88
8.0.60.0200.09549.87
8.0.50.0200.09349.68
8.0.30.0840.21350.14
8.0.20.0720.20649.78
8.0.10.0230.09349.81
8.0.00.0900.17449.55
7.4.330.0270.08447.09
7.4.320.0470.10749.43
7.4.300.0200.09249.54
7.4.290.0230.09349.44
7.4.280.0310.08649.51
7.4.270.0200.09849.46
7.4.260.0200.10049.50
7.4.250.0200.10149.47
7.4.240.0230.09349.44
7.4.230.0200.09449.54
7.4.220.0710.18049.60
7.4.210.0370.17949.34
7.4.200.0300.09349.61
7.4.160.0600.18949.45
7.4.150.0560.17249.44
7.4.140.0590.17749.38
7.4.130.0610.17149.48
7.4.120.0680.16549.62
7.4.110.0490.19749.41
7.4.100.0470.17649.56
7.4.90.0620.15949.49
7.4.80.0630.17249.42
7.4.70.0680.22649.57
7.4.60.0520.19149.66
7.4.50.0170.06449.39
7.4.40.0750.15649.23
7.4.30.0770.14849.45
7.4.00.0370.13747.86
7.3.330.0500.21778.13
7.3.320.0600.21678.32
7.3.310.0200.10749.30
7.3.300.0240.10149.12
7.3.290.0580.17049.27
7.3.280.0500.21249.28
7.3.270.0620.17449.50
7.3.260.0830.16049.58
7.3.250.0700.16849.37
7.3.240.0680.17649.32
7.3.230.0460.19749.34
7.3.210.0670.17149.49
7.3.200.0760.17949.27
7.3.190.0950.24049.45
7.3.180.0590.20449.54
7.3.170.0760.18449.26
7.3.160.0680.16349.46
7.3.120.0430.14647.55
7.3.110.0430.12647.47
7.3.100.0400.12847.89
7.3.90.0330.16647.85
7.3.80.0300.16047.76
7.3.70.0330.14147.74
7.3.60.0200.15047.79
7.3.50.0230.14347.61
7.3.40.0300.16347.45
7.3.30.0330.15347.79
7.3.20.3350.13150.52
7.3.10.0710.14750.55
7.3.00.0620.14450.51
7.2.330.0820.13249.57
7.2.320.0590.16849.75
7.2.310.0620.26949.50
7.2.300.0510.16149.60
7.2.290.0770.24549.84
7.2.240.0300.17848.19
7.2.230.0230.16747.64
7.2.220.0370.17548.11
7.2.210.0300.18048.20
7.2.200.0470.14447.93
7.2.190.0230.17048.08
7.2.180.0270.17247.70
7.2.170.0370.17147.88
7.2.160.0300.16647.89
7.2.150.0630.15750.70
7.2.140.0170.14451.00
7.2.130.0890.16050.77
7.2.120.0620.16450.56
7.2.110.0590.17349.96
7.2.100.0720.17150.06
7.2.90.0730.16050.89
7.2.80.0700.16150.70
7.2.70.0580.16350.77
7.2.60.0980.13550.86
7.2.50.0630.16350.96
7.2.40.0710.16850.76
7.2.30.0790.16450.82
7.2.20.0780.15650.18
7.2.10.0740.16850.05
7.2.00.1010.15950.68
7.1.330.1060.23649.27
7.1.320.0100.23249.83
7.1.310.0070.25749.97
7.1.300.0170.25049.71
7.1.290.0130.24549.66
7.1.280.0160.25749.54
7.1.270.2230.25049.64
7.1.260.0070.24049.60
7.1.250.0600.24649.51
7.1.200.0770.09349.65
7.1.100.0100.09951.84
7.1.70.1430.09851.21
7.1.60.0130.16251.49
7.1.50.0100.11451.13
7.1.00.0100.21356.27
7.0.200.0240.10950.87
7.0.140.0170.21056.12
7.0.60.0370.18352.94
7.0.50.0200.19350.69
7.0.40.0370.12351.83
7.0.30.1170.14351.90
7.0.20.1100.13351.84
7.0.10.0230.16051.79
7.0.00.0370.13051.79
5.6.280.0200.27385.73
5.6.210.0300.22385.12
5.6.200.0170.24782.82
5.6.190.0130.19085.02
5.6.180.0500.17384.86
5.6.170.0400.20384.97
5.6.160.0270.23084.81
5.6.150.0200.24082.79
5.6.140.0400.20782.74
5.6.130.0230.22382.77
5.6.120.0230.23385.54
5.6.110.0430.15385.63
5.6.100.0270.25085.63
5.6.90.0330.23785.69
5.6.80.0130.17085.06
5.5.350.3830.18785.03
5.5.340.0300.23782.65
5.5.330.0400.22384.82
5.5.320.0470.18784.89
5.5.310.0470.20784.78
5.5.300.0370.21082.61
5.5.290.0170.21382.61
5.5.280.0270.24785.30
5.5.270.0430.28085.50
5.5.260.0270.22385.41
5.5.250.0400.23085.25
5.5.240.0400.21084.91
5.4.450.0570.32083.77
5.4.440.0570.30784.11
5.4.430.0700.38084.07
5.4.420.0670.32783.91
5.4.410.0830.27083.79
5.4.400.1500.30383.92
5.4.390.1200.40383.72
5.4.380.1100.30383.66
5.4.370.1430.37083.72
5.4.360.0470.37783.53
5.4.350.1470.38383.86
5.4.340.0290.24376.73
5.4.320.0350.26077.22
5.4.310.0320.23577.22
5.4.300.0300.24577.22
5.4.290.0200.22977.21
5.4.280.0530.32877.11
5.4.270.0210.27777.11
5.4.260.0260.26277.12
5.4.250.0370.27577.12
5.4.240.0310.23877.12
5.4.230.0340.25877.11
5.4.220.0340.34777.11
5.4.210.0410.29177.11
5.4.200.0340.26077.11
5.4.190.0210.23377.10
5.4.180.0290.22677.11
5.4.170.0190.24477.11
5.4.160.0270.25077.12
5.4.150.0310.24977.11
5.4.140.0250.23376.79
5.4.130.0240.23276.78
5.4.120.0190.24576.73
5.4.110.0310.24276.73
5.4.100.0230.26776.73
5.4.90.0350.23076.73
5.4.80.0310.21976.74
5.4.70.0250.24176.73
5.4.60.0380.28776.73
5.4.50.0240.22876.73
5.4.40.0290.23476.72
5.4.30.0330.29476.71
5.4.20.0240.24676.71
5.4.10.0250.23676.71
5.4.00.0230.26476.20
5.3.290.0070.04112.80
5.3.280.0080.04212.71
5.3.270.0080.03712.73
5.3.260.0090.03712.72
5.3.250.0070.03612.72
5.3.240.0030.04012.72
5.3.230.0070.03712.71
5.3.220.0060.03612.68
5.3.210.0070.03812.68
5.3.200.0080.03512.68
5.3.190.0050.04012.68
5.3.180.0070.03812.67
5.3.170.0060.03812.67
5.3.160.0050.03812.67
5.3.150.0080.03612.67
5.3.140.0060.03912.66
5.3.130.0080.03712.66
5.3.120.0060.05212.66
5.3.110.0070.04412.66
5.3.100.0080.03712.13
5.3.90.0100.03712.11
5.3.80.0090.03312.09
5.3.70.0080.03712.09
5.3.60.0090.03912.09
5.3.50.0090.04312.02
5.3.40.0100.04412.02
5.3.30.0080.03811.98
5.3.20.0040.03811.77
5.3.10.0070.03511.74
5.3.00.0030.04011.72
5.2.170.0040.0329.21
5.2.160.0080.0269.21
5.2.150.0050.0319.22
5.2.140.0050.0309.21
5.2.130.0040.0329.17
5.2.120.0090.0379.17
5.2.110.0110.0349.18
5.2.100.0050.0289.18
5.2.90.0050.0329.18
5.2.80.0060.0409.17
5.2.70.0040.0429.17
5.2.60.0050.0419.13
5.2.50.0040.0439.09
5.2.40.0070.0389.07
5.2.30.0090.0389.05
5.2.20.0040.0329.04
5.2.10.0040.0298.95
5.2.00.0060.0288.81
5.1.60.0080.0248.09
5.1.50.0040.0318.08
5.1.40.0070.0278.07
5.1.30.0030.0288.42
5.1.20.0030.0318.44
5.1.10.0040.0258.16
5.1.00.0040.0268.16
5.0.50.0020.0226.64
5.0.40.0030.0206.50
5.0.30.0050.0296.31
5.0.20.0030.0196.29
5.0.10.0040.0266.26
5.0.00.0070.0376.25
4.4.90.0020.0214.78
4.4.80.0040.0134.76
4.4.70.0000.0184.75
4.4.60.0020.0164.76
4.4.50.0020.0174.77
4.4.40.0030.0244.71
4.4.30.0050.0134.76
4.4.20.0040.0144.84
4.4.10.0030.0154.85
4.4.00.0030.0254.76
4.3.110.0010.0184.67
4.3.100.0020.0164.67
4.3.90.0050.0134.63
4.3.80.0050.0284.58
4.3.70.0020.0154.63
4.3.60.0040.0144.63
4.3.50.0020.0164.63
4.3.40.0040.0234.54
4.3.30.0030.0163.30
4.3.20.0030.0153.28
4.3.10.0030.0153.24
4.3.00.0000.0276.86

preferences:
41.81 ms | 401 KiB | 5 Q