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]]); 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,1,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.40.0120.00618.79
8.3.30.0070.00719.25
8.3.20.0000.00720.20
8.3.10.0050.00323.78
8.3.00.0110.00419.38
8.2.170.0120.00322.96
8.2.160.0090.00620.35
8.2.150.0110.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0070.00022.18
8.2.110.0000.00820.35
8.2.100.0080.00418.16
8.2.90.0080.00019.22
8.2.80.0080.00017.97
8.2.70.0030.00617.75
8.2.60.0050.00517.93
8.2.50.0000.00818.07
8.2.40.0040.00420.07
8.2.30.0060.00318.03
8.2.20.0000.00817.90
8.2.10.0000.00718.23
8.2.00.0040.00417.74
8.1.270.0080.00022.02
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00423.84
8.1.230.0120.00019.16
8.1.220.0000.00817.76
8.1.210.0040.00418.77
8.1.200.0090.00017.10
8.1.190.0040.00417.22
8.1.180.0050.00318.10
8.1.170.0040.00418.52
8.1.160.0040.00421.95
8.1.150.0030.00618.88
8.1.140.0040.00417.45
8.1.130.0030.00317.83
8.1.120.0000.00717.48
8.1.110.0000.00817.38
8.1.100.0000.00717.53
8.1.90.0000.00717.38
8.1.80.0030.00517.33
8.1.70.0070.00017.43
8.1.60.0040.00417.67
8.1.50.0030.00517.46
8.1.40.0000.00817.55
8.1.30.0040.00417.65
8.1.20.0030.00517.65
8.1.10.0000.00817.57
8.1.00.0040.00417.46
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0030.00318.39
8.0.270.0000.00717.29
8.0.260.0050.00317.18
8.0.250.0030.00316.92
8.0.240.0040.00417.00
8.0.230.0040.00417.05
8.0.220.0000.00816.93
8.0.210.0030.00316.95
8.0.200.0000.00716.96
8.0.190.0040.00416.93
8.0.180.0000.00716.98
8.0.170.0070.00017.02
8.0.160.0040.00416.94
8.0.150.0070.00016.81
8.0.140.0030.00516.93
8.0.130.0000.00613.44
8.0.120.0060.00316.96
8.0.110.0020.00517.00
8.0.100.0050.00317.04
8.0.90.0000.00716.83
8.0.80.0100.00716.93
8.0.70.0050.00316.89
8.0.60.0050.00317.01
8.0.50.0040.00416.99
8.0.30.0120.01017.08
8.0.20.0080.01217.40
8.0.10.0000.00717.12
8.0.00.0100.01116.82
7.4.330.0050.00015.05
7.4.320.0050.00316.55
7.4.300.0030.00316.60
7.4.290.0040.00416.53
7.4.280.0040.00416.46
7.4.270.0070.00016.63
7.4.260.0040.00416.40
7.4.250.0040.00416.39
7.4.240.0050.00216.50
7.4.230.0070.00016.72
7.4.220.0060.01616.48
7.4.210.0130.00716.59
7.4.200.0070.00016.45
7.4.160.0060.01616.58
7.4.150.0080.01117.40
7.4.140.0140.00917.86
7.4.130.0060.01216.56
7.4.120.0090.00816.58
7.4.110.0160.00616.54
7.4.100.0130.00416.42
7.4.90.0160.00016.39
7.4.80.0140.01019.39
7.4.70.0060.01116.52
7.4.60.0060.01216.44
7.4.50.0030.00516.68
7.4.40.0110.00516.52
7.4.30.0120.00916.50
7.4.00.0060.01215.14
7.3.330.0060.00013.20
7.3.320.0030.00313.34
7.3.310.0050.00316.41
7.3.300.0000.00716.46
7.3.290.0030.01116.38
7.3.280.0080.00916.33
7.3.270.0120.00617.40
7.3.260.0040.01716.54
7.3.250.0130.00616.51
7.3.240.0120.00616.53
7.3.230.0120.00416.42
7.3.210.0060.01016.52
7.3.200.0090.01219.39
7.3.190.0130.00316.44
7.3.180.0100.00616.58
7.3.170.0120.00916.59
7.3.160.0100.00616.44
7.2.330.0080.00916.70
7.2.320.0130.01516.46
7.2.310.0090.00916.73
7.2.300.0100.00716.47
7.2.290.0070.01316.70
7.2.60.0200.00316.92
7.2.50.0060.00317.01
7.1.200.0030.01015.77
7.1.100.0000.01417.97
7.1.70.0040.00417.09
7.1.60.0070.01819.11
7.1.50.0140.01016.69
7.1.00.0070.06722.40
7.0.200.0070.00316.83
7.0.140.0130.06722.18
7.0.60.0070.07020.08
7.0.50.0030.04317.75
7.0.40.0070.04320.16
7.0.30.0300.07020.23
7.0.20.0070.05320.34
7.0.10.0200.03720.26
7.0.00.0070.04020.20
5.6.280.0030.07321.03
5.6.210.0070.03720.54
5.6.200.0100.07318.19
5.6.190.0070.08720.47
5.6.180.0200.05720.31
5.6.170.0330.07720.47
5.6.160.0100.09020.46
5.6.150.0030.04018.26
5.6.140.0000.04718.18
5.6.130.0070.08018.16
5.6.120.0130.07720.98
5.6.110.0070.06021.11
5.6.100.0070.04021.00
5.6.90.0000.04320.98
5.6.80.0000.07320.52
5.6.70.0130.07020.45
5.5.350.0230.07720.51
5.5.340.0030.08018.05
5.5.330.0100.04020.57
5.5.320.0170.07020.43
5.5.310.0170.05320.27
5.5.300.0070.07718.04
5.5.290.0070.04318.08
5.5.280.0200.07020.67
5.5.270.0030.07720.91
5.5.260.0100.04020.74
5.5.250.0000.04320.71
5.5.240.0130.07720.18
5.4.450.0800.05319.59
5.4.440.0800.05719.48
5.4.430.0630.05319.18
5.4.420.0070.06019.38
5.4.410.0830.05719.34
5.4.400.0730.04719.38
5.4.390.0730.05718.84
5.4.380.0800.05019.26
5.4.370.0600.05719.25
5.4.360.0400.05719.13
5.4.350.0600.05719.15
5.4.340.0050.03812.03
5.4.320.0080.04112.53
5.4.310.0110.05212.52
5.4.300.0160.07612.53
5.4.290.0080.05012.52
5.4.280.0100.05512.42
5.4.270.0110.04512.41
5.4.260.0070.05112.42
5.4.250.0070.05112.41
5.4.240.0060.05012.42
5.4.230.0060.03712.41
5.4.220.0050.03812.41
5.4.210.0060.04612.40
5.4.200.0080.05012.41
5.4.190.0120.04612.40
5.4.180.0080.04612.39
5.4.170.0040.03812.42
5.4.160.0080.03512.40
5.4.150.0100.04412.41
5.4.140.0130.04612.09
5.4.130.0020.05312.07
5.4.120.0100.04612.03
5.4.110.0100.06212.03
5.4.100.0130.04712.02
5.4.90.0140.04712.02
5.4.80.0080.04612.03
5.4.70.0090.05012.03
5.4.60.0140.05812.03
5.4.50.0060.05512.03
5.4.40.0120.05812.01
5.4.30.0090.04412.01
5.4.20.0060.03912.01
5.4.10.0090.03312.01
5.4.00.0080.04011.50
5.3.290.0070.05412.80
5.3.280.0060.04912.71
5.3.270.0070.04312.73
5.3.260.0080.04412.72
5.3.250.0130.04712.72
5.3.240.0040.04712.72
5.3.230.0110.03412.71
5.3.220.0040.04112.68
5.3.210.0030.04212.68
5.3.200.0110.05612.68
5.3.190.0070.04212.68
5.3.180.0060.04312.68
5.3.170.0080.04112.67
5.3.160.0060.04512.67
5.3.150.0050.04012.68
5.3.140.0100.04212.66
5.3.130.0040.05812.66
5.3.120.0090.04712.66
5.3.110.0110.05812.66
5.3.100.0130.04012.13
5.3.90.0050.04712.11
5.3.80.0080.04212.09
5.3.70.0180.05512.09
5.3.60.0080.04112.09
5.3.50.0050.03912.02
5.3.40.0060.03712.02
5.3.30.0100.05011.99
5.3.20.0100.04811.77
5.3.10.0110.05011.73
5.3.00.0090.06911.72
5.2.170.0070.0409.21
5.2.160.0140.0489.21
5.2.150.0110.0359.21
5.2.140.0100.0359.21
5.2.130.0100.0449.18
5.2.120.0150.0619.18
5.2.110.0080.0519.18
5.2.100.0070.0329.18
5.2.90.0210.0819.18
5.2.80.0110.0389.18
5.2.70.0050.0439.17
5.2.60.0100.0379.12
5.2.50.0050.0429.09
5.2.40.0090.0479.07
5.2.30.0080.0389.04
5.2.20.0080.0329.04
5.2.10.0050.0298.95
5.2.00.0070.0288.81
5.1.60.0060.0248.09
5.1.50.0090.0298.08
5.1.40.0050.0268.06
5.1.30.0060.0258.43
5.1.20.0030.0328.44
5.1.10.0010.0308.16
5.1.00.0040.0288.16
5.0.50.0060.0206.64
5.0.40.0020.0216.51
5.0.30.0050.0306.31
5.0.20.0050.0176.29
5.0.10.0020.0226.26
5.0.00.0030.0326.25
4.4.90.0030.0154.78
4.4.80.0040.0144.76
4.4.70.0050.0144.75
4.4.60.0030.0174.75
4.4.50.0030.0164.77
4.4.40.0030.0254.71
4.4.30.0050.0144.76
4.4.20.0020.0174.84
4.4.10.0040.0154.85
4.4.00.0040.0244.76
4.3.110.0070.0194.67
4.3.100.0030.0214.66
4.3.90.0050.0194.63
4.3.80.0050.0294.59
4.3.70.0030.0154.63
4.3.60.0020.0164.63
4.3.50.0020.0174.63
4.3.40.0010.0254.54
4.3.30.0000.0183.30
4.3.20.0020.0163.27
4.3.10.0020.0163.24
4.3.00.0230.0177.03

preferences:
44.36 ms | 400 KiB | 5 Q