3v4l.org

run code in 300+ PHP versions simultaneously
<?php function find_group($cond, &$arr, $e = null) { if ($cond($e, reset($arr) || $e === null)) { $e = array_shift($arr); return array_merge([$e], find_group($cond, $arr, $e)); } return []; } function array_group($cond, $arr) { if (empty($arr)) return []; /*while($cond($e, reset($arr))) { $g[] = array_shift($arr); }*/ return array_merge([find_group($arr)], 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,1],[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.0110.00718.68
8.3.50.0270.00521.15
8.3.40.0120.00318.84
8.3.30.0040.01119.04
8.3.20.0060.00320.35
8.3.10.0000.00823.65
8.3.00.0060.00319.38
8.2.180.0120.00616.61
8.2.170.0110.00422.96
8.2.160.0080.00620.52
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0060.00320.27
8.2.110.0080.00319.30
8.2.100.0080.00417.75
8.2.90.0050.00219.13
8.2.80.0060.00317.97
8.2.70.0030.00617.63
8.2.60.0030.00617.80
8.2.50.0030.00618.07
8.2.40.0080.00019.88
8.2.30.0000.01018.03
8.2.20.0040.00417.64
8.2.10.0040.00417.96
8.2.00.0050.00317.71
8.1.280.0110.00725.92
8.1.270.0080.00023.84
8.1.260.0050.00326.35
8.1.250.0050.00228.09
8.1.240.0060.00324.02
8.1.230.0090.00317.42
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0030.00617.23
8.1.190.0040.00417.10
8.1.180.0060.00318.10
8.1.170.0030.00618.59
8.1.160.0040.00421.88
8.1.150.0040.00418.68
8.1.140.0000.00717.28
8.1.130.0000.00717.76
8.1.120.0040.00417.32
8.1.110.0040.00417.28
8.1.100.0040.00417.36
8.1.90.0050.00217.39
8.1.80.0040.00417.37
8.1.70.0030.00317.36
8.1.60.0040.00417.52
8.1.50.0050.00317.55
8.1.40.0040.00417.37
8.1.30.0030.00617.61
8.1.20.0040.00417.62
8.1.10.0000.00817.54
8.1.00.0030.00517.43
8.0.300.0020.00518.77
8.0.290.0030.00616.75
8.0.280.0030.00318.42
8.0.270.0040.00417.23
8.0.260.0030.00317.28
8.0.250.0000.00717.02
8.0.240.0050.00317.04
8.0.230.0000.00717.02
8.0.220.0020.00516.93
8.0.210.0070.00016.97
8.0.200.0000.00717.01
8.0.190.0050.00216.89
8.0.180.0000.00716.91
8.0.170.0050.00316.95
8.0.160.0080.00016.98
8.0.150.0070.00016.95
8.0.140.0000.00816.86
8.0.130.0060.00013.36
8.0.120.0000.00716.88
8.0.110.0050.00316.98
8.0.100.0070.00016.98
8.0.90.0000.00716.84
8.0.80.0090.00616.93
8.0.70.0080.00016.97
8.0.60.0070.00016.95
8.0.50.0040.00316.76
8.0.30.0140.00516.98
8.0.20.0100.01317.40
8.0.10.0040.00416.95
8.0.00.0080.01016.71
7.4.330.0050.00015.02
7.4.320.0060.00016.52
7.4.300.0060.00016.43
7.4.290.0040.00416.53
7.4.280.0040.00416.53
7.4.270.0030.00316.58
7.4.260.0040.00416.44
7.4.250.0050.00216.34
7.4.240.0040.00416.50
7.4.230.0030.00316.64
7.4.220.0040.01316.64
7.4.210.0030.01216.51
7.4.200.0070.00016.60
7.4.160.0200.00316.50
7.4.150.0120.00617.40
7.4.140.0150.00317.86
7.4.130.0050.01316.53
7.4.120.0120.00716.49
7.4.110.0060.01216.44
7.4.100.0140.00416.46
7.4.90.0070.01016.44
7.4.80.0100.00719.39
7.4.70.0140.00716.46
7.4.60.0150.00816.45
7.4.50.0040.00416.45
7.4.40.0040.01116.59
7.4.30.0160.00316.46
7.4.10.0100.00715.11
7.4.00.0060.00814.98
7.3.330.0020.00213.16
7.3.320.0020.00213.19
7.3.310.0050.00316.14
7.3.300.0050.00216.34
7.3.290.0080.01216.31
7.3.280.0110.00816.32
7.3.270.0140.00417.40
7.3.260.0090.00916.37
7.3.250.0080.01116.43
7.3.240.0100.00616.23
7.3.230.0100.00716.39
7.3.210.0120.00316.21
7.3.200.0070.01019.39
7.3.190.0060.01716.16
7.3.180.0120.00416.43
7.3.170.0130.00316.46
7.3.160.0050.01016.47
7.3.130.0140.00714.87
7.3.120.0110.01114.82
7.3.110.0090.00914.87
7.3.100.0130.00614.85
7.3.90.0090.00914.78
7.3.80.0040.00814.51
7.3.70.0030.01714.97
7.3.60.0040.01514.91
7.3.50.0030.01314.44
7.3.40.0100.00014.57
7.3.30.0060.00614.93
7.3.20.0120.00316.67
7.3.10.0070.00716.41
7.3.00.0040.00716.76
7.2.330.0140.00316.49
7.2.320.0160.00316.75
7.2.310.0070.01016.30
7.2.300.0080.00816.70
7.2.290.0100.00716.23
7.2.260.0070.01715.04
7.2.250.0040.01214.78
7.2.240.0070.01014.93
7.2.230.0100.00715.04
7.2.220.0040.01514.70
7.2.210.0050.00515.21
7.2.200.0100.00715.04
7.2.190.0090.00615.02
7.2.180.0080.00815.04
7.2.170.0040.00814.73
7.2.160.0040.00714.82
7.2.150.0070.00716.72
7.2.140.0030.00616.84
7.2.130.0000.01216.95
7.2.120.0070.00716.58
7.2.110.0000.01016.70
7.2.100.0000.01716.89
7.2.90.0100.00716.85
7.2.80.0120.00316.77
7.2.70.0070.00716.50
7.2.60.0090.00516.68
7.2.50.0030.01016.70
7.2.40.0070.00716.72
7.2.30.0040.01116.90
7.2.20.0090.00616.82
7.2.10.0040.01116.97
7.2.00.0080.00517.93
7.1.330.0060.00915.66
7.1.320.0030.01415.87
7.1.310.0030.00715.50
7.1.300.0090.00615.74
7.1.290.0000.01415.68
7.1.280.0040.01115.88
7.1.270.0030.00615.63
7.1.260.0080.00815.80
7.1.250.0030.00815.49
7.1.240.0070.00715.72
7.1.230.0060.00615.71
7.1.220.0040.00815.74
7.1.210.0080.00415.62
7.1.200.0100.00715.51
7.1.190.0090.00415.76
7.1.180.0000.00815.59
7.1.170.0000.01515.70
7.1.160.0070.01015.66
7.1.150.0000.01515.78
7.1.140.0060.00615.68
7.1.130.0070.00715.62
7.1.120.0000.01115.74
7.1.110.0060.00315.53
7.1.100.0060.00717.10
7.1.90.0080.00615.81
7.1.80.0000.01115.56
7.1.70.0040.00516.22
7.1.60.0050.00917.55
7.1.50.0100.00816.35
7.1.40.0060.00315.58
7.1.30.0060.00615.55
7.1.20.0110.00315.71
7.1.10.0030.00915.67
7.1.00.0060.03818.98
7.0.330.0140.00015.35
7.0.320.0040.00915.36
7.0.310.0040.00815.40
7.0.300.0000.01515.44
7.0.290.0030.00715.06
7.0.280.0030.00915.27
7.0.270.0070.01015.31
7.0.260.0000.01515.20
7.0.250.0000.01115.34
7.0.240.0040.01115.05
7.0.230.0040.00815.55
7.0.220.0000.00815.55
7.0.210.0110.00415.59
7.0.200.0080.00515.92
7.0.190.0140.00015.50
7.0.180.0030.00615.34
7.0.170.0140.00015.50
7.0.160.0100.00315.54
7.0.150.0000.01615.47
7.0.140.0050.04118.84
7.0.130.0030.01015.52
7.0.120.0050.00515.51
7.0.110.0040.01215.43
7.0.100.0070.00715.27
7.0.90.0070.00715.34
7.0.80.0030.00715.12
7.0.70.0070.00715.47
7.0.60.0070.04217.61
7.0.50.0050.04016.73
7.0.40.0060.02516.83
7.0.30.0150.04516.89
7.0.20.0200.05016.76
7.0.10.0180.04316.77
7.0.00.0020.04916.70
5.6.400.0030.01014.38
5.6.390.0110.00714.63
5.6.380.0060.00914.33
5.6.370.0080.00514.50
5.6.360.0130.00314.40
5.6.350.0070.01014.02
5.6.340.0070.00714.52
5.6.330.0070.00714.53
5.6.320.0070.01014.07
5.6.310.0070.01014.42
5.6.300.0060.00314.53
5.6.290.0030.01214.25
5.6.280.0080.04617.71
5.6.270.0040.00414.14
5.6.260.0120.00314.55
5.6.250.0080.00814.58
5.6.240.0040.01114.23
5.6.230.0040.00714.37
5.6.220.0070.01114.23
5.6.210.0080.02417.28
5.6.200.0030.03116.28
5.6.190.0020.05217.49
5.6.180.0200.04017.52
5.6.170.0100.02917.56
5.6.160.0070.02517.45
5.6.150.0070.04216.21
5.6.140.0100.04116.24
5.6.130.0020.03516.23
5.6.120.0070.04617.71
5.6.110.0030.03517.64
5.6.100.0090.04117.79
5.6.90.0020.05217.69
5.6.80.0050.04817.43
5.6.70.0120.01617.23
5.6.60.0030.01014.20
5.6.50.0030.00914.14
5.6.40.0060.01214.17
5.6.30.0030.01214.20
5.6.20.0040.00414.04
5.6.10.0150.00014.28
5.6.00.0090.00914.25
5.5.380.0060.00314.13
5.5.370.0070.01014.41
5.5.360.0100.00714.08
5.5.350.0070.04317.27
5.5.340.0040.02216.22
5.5.330.0080.03617.48
5.5.320.0100.03917.44
5.5.310.0180.04217.24
5.5.300.0050.04316.19
5.5.290.0030.02616.04
5.5.280.0050.02317.63
5.5.270.0030.05117.51
5.5.260.0050.04717.60
5.5.250.0130.01817.33
5.5.240.0050.02417.15
5.5.230.0040.01114.01
5.5.220.0080.00614.35
5.5.210.0080.00414.17
5.5.200.0070.01114.16
5.5.190.0030.00913.82
5.5.180.0030.01014.09
5.5.170.0030.01014.03
5.5.160.0110.00714.29
5.5.150.0100.00614.24
5.5.140.0000.01314.16
5.5.130.0030.01214.27
5.5.120.0100.00314.27
5.5.110.0030.01014.42
5.5.100.0060.00314.30
5.5.90.0080.00614.17
5.5.80.0030.00913.92
5.5.70.0060.00914.28
5.5.60.0030.01314.33
5.5.50.0040.01214.34
5.5.40.0040.00813.93
5.5.30.0070.01014.21
5.5.20.0100.00714.13
5.5.10.0000.01413.95
5.5.00.0040.00414.40
5.4.450.0170.04015.26
5.4.440.0240.02815.29
5.4.430.0100.02415.29
5.4.420.0180.03615.38
5.4.410.0080.02415.00
5.4.400.0170.03715.04
5.4.390.0130.03814.85
5.4.380.0200.03514.88
5.4.370.0150.02515.01
5.4.360.0180.02214.91
5.4.350.0110.02115.00
5.4.340.0120.04514.94
5.4.330.0030.00710.85
5.4.320.0130.03214.90
5.4.310.0150.03615.17
5.4.300.0140.02214.89
5.4.290.0160.03715.10
5.4.280.0090.02915.03
5.4.270.0120.02015.01
5.4.260.0080.02315.03
5.4.250.0080.03214.76
5.4.240.0120.02015.04
5.4.230.0130.02314.89
5.4.220.0150.02214.99
5.4.210.0130.02015.01
5.4.200.0150.03714.84
5.4.190.0120.04214.85
5.4.180.0140.03914.82
5.4.170.0130.02314.92
5.4.160.0150.03415.05
5.4.150.0180.03814.89
5.4.140.0160.03113.56
5.4.130.0140.03413.62
5.4.120.0120.03413.64
5.4.110.0130.03013.69
5.4.100.0170.03513.67
5.4.90.0150.02013.61
5.4.80.0130.02813.79
5.4.70.0200.01713.68
5.4.60.0120.02313.58
5.4.50.0150.03313.71
5.4.40.0200.03313.54
5.4.30.0180.03213.76
5.4.20.0140.03913.67
5.4.10.0120.02713.51
5.4.00.0100.02213.36
5.3.290.0200.04014.57
5.3.280.0230.07014.49
5.3.270.0200.05314.62
5.3.260.0270.03714.58
5.3.250.0230.07014.52
5.3.240.0270.07014.51
5.3.230.0200.05014.68
5.3.220.0200.05014.72
5.3.210.0230.03314.54
5.3.200.0200.04314.58
5.3.190.0130.04314.73
5.3.180.0300.06014.62
5.3.170.0330.05714.64
5.3.160.0330.08014.48
5.3.150.0270.07014.54
5.3.140.0230.07014.47
5.3.130.0170.05014.48
5.3.120.0130.04314.68
5.3.110.0200.04014.52
5.3.100.0300.06714.05
5.3.90.0270.06314.08
5.3.80.0230.03713.95
5.3.70.0170.05713.92
5.3.60.0230.06714.10
5.3.50.0330.03014.03
5.3.40.0130.04013.92
5.3.30.0200.03313.81
5.3.20.0200.06713.73
5.3.10.0130.04013.68
5.3.00.0230.05713.72
5.2.170.0170.04011.21
5.2.160.0100.03311.15
5.2.150.0100.03011.20
5.2.140.0200.02711.04
5.2.130.0100.03711.25
5.2.120.0100.03011.03
5.2.110.0070.03311.03
5.2.100.0070.03311.03
5.2.90.0100.03011.03
5.2.80.0100.03311.07
5.2.70.0200.03011.05
5.2.60.0170.03011.14
5.2.50.0130.03310.92
5.2.40.0130.02711.11
5.2.30.0170.02311.19
5.2.20.0070.03710.97
5.2.10.0100.03010.77
5.2.00.0130.05310.64
5.1.60.0030.0309.92
5.1.50.0100.0509.98
5.1.40.0170.03010.13
5.1.30.0130.02710.35
5.1.20.0100.02710.50
5.1.10.0070.03010.22
5.1.00.0100.0239.99
5.0.50.0070.0238.77
5.0.40.0030.0238.39
5.0.30.0000.0378.25
5.0.20.0100.0178.33
5.0.10.0130.0138.10
5.0.00.0030.0308.16
4.4.90.0030.0237.76
4.4.80.0070.0177.76
4.4.70.0030.0177.76
4.4.60.0070.0177.76
4.4.50.0130.0137.76
4.4.40.0130.0207.76
4.4.30.0030.0177.76
4.4.20.0070.0137.76
4.4.10.0070.0137.76
4.4.00.0030.0337.76
4.3.110.0030.0177.76
4.3.100.0070.0137.76
4.3.90.0030.0177.76
4.3.80.0000.0277.76
4.3.70.0070.0137.76
4.3.60.0130.0077.76
4.3.50.0030.0307.76
4.3.40.0000.0337.76
4.3.30.0100.0177.76
4.3.20.0000.0177.76
4.3.10.0030.0307.76
4.3.00.0000.0177.76

preferences:
52.41 ms | 401 KiB | 5 Q