3v4l.org

run code in 300+ PHP versions simultaneously
<?php function find_group($cond, &$arr, $e = null) { if (empty($arr)) return []; if ($e === null || $cond($e, reset($arr))) { $ne = array_shift($arr); return array_merge([$ne], find_group($cond, $arr, ($e === null) ? $ne : $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($cond, $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.00418.18
8.3.50.0130.00522.03
8.3.40.0000.01518.70
8.3.30.0110.00419.08
8.3.20.0080.00020.34
8.3.10.0050.00323.67
8.3.00.0030.00619.26
8.2.180.0110.00716.50
8.2.170.0110.00422.96
8.2.160.0100.00320.36
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0000.01020.36
8.2.110.0110.00719.32
8.2.100.0090.00317.75
8.2.90.0000.00919.22
8.2.80.0080.00017.97
8.2.70.0040.00417.63
8.2.60.0040.00417.93
8.2.50.0080.00318.07
8.2.40.0060.00319.88
8.2.30.0040.00418.09
8.2.20.0080.00017.63
8.2.10.0040.00418.00
8.2.00.0040.00417.70
8.1.280.0110.00625.92
8.1.270.0060.00323.96
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00323.97
8.1.230.0060.00617.42
8.1.220.0000.00917.79
8.1.210.0060.00318.77
8.1.200.0030.00717.23
8.1.190.0000.00817.23
8.1.180.0060.00318.10
8.1.170.0040.00418.67
8.1.160.0040.00422.05
8.1.150.0040.00418.91
8.1.140.0090.00017.52
8.1.130.0040.00417.40
8.1.120.0040.00417.54
8.1.110.0000.00817.38
8.1.100.0040.00417.54
8.1.90.0000.00817.52
8.1.80.0040.00417.43
8.1.70.0030.00317.50
8.1.60.0040.00417.50
8.1.50.0030.00617.53
8.1.40.0000.00817.44
8.1.30.0040.00417.73
8.1.20.0000.00717.70
8.1.10.0040.00417.50
8.1.00.0050.00217.60
8.0.300.0000.00818.77
8.0.290.0050.00216.75
8.0.280.0040.00418.39
8.0.270.0050.00317.22
8.0.260.0030.00316.95
8.0.250.0030.00316.91
8.0.240.0070.00016.96
8.0.230.0000.00716.95
8.0.220.0000.00816.81
8.0.210.0050.00216.79
8.0.200.0030.00316.98
8.0.190.0040.00416.99
8.0.180.0080.00016.93
8.0.170.0080.00016.88
8.0.160.0040.00417.00
8.0.150.0070.00016.91
8.0.140.0050.00216.89
8.0.130.0030.00313.34
8.0.120.0040.00416.89
8.0.110.0040.00416.93
8.0.100.0040.00416.84
8.0.90.0040.00416.79
8.0.80.0130.00316.90
8.0.70.0000.00816.93
8.0.60.0040.00416.77
8.0.50.0050.00316.79
8.0.30.0080.01017.07
8.0.20.0120.01217.40
8.0.10.0040.00416.86
8.0.00.0120.00716.85
7.4.330.0020.00215.09
7.4.320.0030.00316.53
7.4.300.0030.00316.63
7.4.290.0000.00916.39
7.4.280.0000.00716.58
7.4.270.0000.00716.63
7.4.260.0040.00416.60
7.4.250.0040.00416.60
7.4.240.0000.00716.48
7.4.230.0070.00016.61
7.4.220.0040.01716.54
7.4.210.0000.01316.40
7.4.200.0000.00716.54
7.4.160.0100.00616.65
7.4.150.0150.00417.40
7.4.140.0130.01317.86
7.4.130.0070.01016.60
7.4.120.0090.01016.63
7.4.110.0120.00816.57
7.4.100.0080.00916.40
7.4.90.0040.01416.33
7.4.80.0040.01319.39
7.4.70.0140.00316.66
7.4.60.0200.00416.53
7.4.50.0060.00316.43
7.4.40.0100.00616.68
7.4.30.0140.01316.60
7.4.10.0070.01015.04
7.4.00.0090.00714.98
7.3.330.0030.00313.21
7.3.320.0030.00313.32
7.3.310.0000.00816.38
7.3.300.0030.00516.37
7.3.290.0110.00516.41
7.3.280.0080.00916.37
7.3.270.0140.00317.40
7.3.260.0070.01116.51
7.3.250.0080.00916.54
7.3.240.0070.01016.38
7.3.230.0070.01016.68
7.3.210.0040.01316.46
7.3.200.0070.01019.39
7.3.190.0160.00316.71
7.3.180.0030.01316.56
7.3.170.0100.00716.60
7.3.160.0130.00916.48
7.3.130.0030.01015.05
7.3.120.0070.01014.67
7.3.110.0090.00914.54
7.3.100.0100.00614.88
7.3.90.0040.01114.76
7.3.80.0060.00314.59
7.3.70.0030.01014.97
7.3.60.0050.00514.92
7.3.50.0030.01014.70
7.3.40.0040.01114.63
7.3.30.0120.00314.91
7.3.20.0080.00416.78
7.3.10.0030.01316.70
7.3.00.0060.00616.68
7.2.330.0100.00716.70
7.2.320.0110.01116.52
7.2.310.0100.00616.87
7.2.300.0090.01316.51
7.2.290.0090.00916.72
7.2.260.0000.01915.16
7.2.250.0070.01015.41
7.2.240.0120.00315.20
7.2.230.0030.01215.07
7.2.220.0090.00914.99
7.2.210.0080.00815.02
7.2.200.0000.01615.19
7.2.190.0030.01014.89
7.2.180.0000.01414.88
7.2.170.0070.00414.86
7.2.160.0060.00914.98
7.2.150.0000.01417.06
7.2.140.0070.00316.59
7.2.130.0110.00416.86
7.2.120.0060.00317.04
7.2.110.0030.00717.02
7.2.100.0080.00816.86
7.2.90.0060.01217.07
7.2.80.0080.00516.88
7.2.70.0060.01017.13
7.2.60.0090.00316.82
7.2.50.0000.01216.70
7.2.40.0080.01117.13
7.2.30.0080.00816.81
7.2.20.0030.01116.97
7.2.10.0030.01017.00
7.2.00.0060.00718.13
7.1.330.0040.01115.84
7.1.320.0080.00615.76
7.1.310.0070.00315.70
7.1.300.0130.00015.71
7.1.290.0080.00315.98
7.1.280.0080.00415.95
7.1.270.0040.01215.80
7.1.260.0070.00315.79
7.1.250.0000.01715.77
7.1.240.0060.00615.77
7.1.230.0100.00315.98
7.1.220.0030.01015.66
7.1.210.0030.00715.91
7.1.200.0080.00815.70
7.1.190.0110.00415.90
7.1.180.0030.01015.85
7.1.170.0070.00715.64
7.1.160.0030.01215.67
7.1.150.0090.00915.80
7.1.140.0000.01115.90
7.1.130.0040.00415.77
7.1.120.0000.01415.91
7.1.110.0090.00315.66
7.1.100.0020.01117.05
7.1.90.0070.00716.07
7.1.80.0110.00415.81
7.1.70.0060.00616.48
7.1.60.0040.01617.54
7.1.50.0050.01316.19
7.1.40.0030.01115.61
7.1.30.0030.00615.82
7.1.20.0030.01015.80
7.1.10.0000.01715.83
7.1.00.0030.04319.06
7.0.330.0070.00715.18
7.0.320.0050.00515.45
7.0.310.0030.01015.36
7.0.300.0030.01015.44
7.0.290.0120.00315.15
7.0.280.0040.00415.25
7.0.270.0000.01215.55
7.0.260.0090.00615.20
7.0.250.0060.00615.42
7.0.240.0070.00715.49
7.0.230.0070.00715.27
7.0.220.0030.00715.15
7.0.210.0040.00415.68
7.0.200.0040.00716.14
7.0.190.0090.00615.22
7.0.180.0000.00915.59
7.0.170.0030.01015.64
7.0.160.0080.00415.43
7.0.150.0030.01415.22
7.0.140.0080.03518.67
7.0.130.0040.00815.35
7.0.120.0110.00315.50
7.0.110.0040.01115.44
7.0.100.0090.00615.50
7.0.90.0060.00615.54
7.0.80.0100.00015.42
7.0.70.0090.00615.36
7.0.60.0030.03017.79
7.0.50.0050.04716.78
7.0.40.0050.02516.76
7.0.30.0130.03816.74
7.0.20.0230.03816.93
7.0.10.0120.02716.64
7.0.00.0070.03516.87
5.6.400.0070.00414.74
5.6.390.0080.00014.31
5.6.380.0060.00314.39
5.6.370.0070.00714.29
5.6.360.0040.00414.29
5.6.350.0000.01114.48
5.6.340.0030.00514.11
5.6.330.0030.00914.38
5.6.320.0060.00614.14
5.6.310.0060.00914.23
5.6.300.0060.00314.40
5.6.290.0030.00814.12
5.6.280.0020.05517.68
5.6.270.0070.00714.44
5.6.260.0030.01214.48
5.6.250.0040.01014.52
5.6.240.0070.00714.40
5.6.230.0100.00014.20
5.6.220.0110.00414.14
5.6.210.0070.04317.57
5.6.200.0050.02416.33
5.6.190.0090.03917.43
5.6.180.0170.02717.44
5.6.170.0080.02717.40
5.6.160.0050.02517.26
5.6.150.0080.04216.27
5.6.140.0070.04316.33
5.6.130.0050.05216.43
5.6.120.0060.04317.79
5.6.110.0080.04517.62
5.6.100.0090.03217.67
5.6.90.0070.03017.73
5.6.80.0050.03917.26
5.6.70.0070.02417.35
5.6.60.0060.01014.25
5.6.50.0000.01114.11
5.6.40.0030.01314.21
5.6.30.0110.00714.04
5.6.20.0060.00614.11
5.6.10.0100.00314.36
5.6.00.0030.01014.14
5.5.380.0100.00314.12
5.5.370.0030.01014.07
5.5.360.0070.00714.19
5.5.350.0140.03817.35
5.5.340.0070.03216.23
5.5.330.0030.02517.32
5.5.320.0140.04517.40
5.5.310.0170.04217.26
5.5.300.0030.02516.27
5.5.290.0030.02416.37
5.5.280.0090.03717.63
5.5.270.0060.02617.65
5.5.260.0020.03217.45
5.5.250.0050.04717.50
5.5.240.0070.03017.15
5.5.230.0030.00614.45
5.5.220.0040.00714.28
5.5.210.0000.01614.37
5.5.200.0140.00014.08
5.5.190.0070.00714.18
5.5.180.0070.00714.48
5.5.170.0070.00713.98
5.5.160.0060.00914.41
5.5.150.0090.00614.43
5.5.140.0070.00414.18
5.5.130.0030.01014.27
5.5.120.0040.01414.18
5.5.110.0030.01014.31
5.5.100.0030.01514.45
5.5.90.0090.00914.36
5.5.80.0070.00714.18
5.5.70.0030.00913.87
5.5.60.0040.00814.40
5.5.50.0060.00914.42
5.5.40.0040.01414.21
5.5.30.0060.00614.08
5.5.20.0080.00314.31
5.5.10.0030.01014.17
5.5.00.0110.00314.44
5.4.450.0480.03016.08
5.4.440.0500.03616.15
5.4.430.0420.03616.16
5.4.420.0380.03416.16
5.4.410.0060.03516.02
5.4.400.0460.02816.07
5.4.390.0560.03615.94
5.4.380.0510.02315.94
5.4.370.0490.02916.05
5.4.360.0470.03015.96
5.4.350.0270.02515.85
5.4.340.0050.02012.44
5.4.330.0000.01012.86
5.4.320.0050.02012.69
5.4.310.0050.02212.69
5.4.300.0060.02112.69
5.4.290.0040.02412.69
5.4.280.0060.02112.64
5.4.270.0080.02112.64
5.4.260.0050.02312.64
5.4.250.0050.02312.64
5.4.240.0060.02612.64
5.4.230.0060.03112.63
5.4.220.0080.02612.63
5.4.210.0020.03112.63
5.4.200.0020.02512.63
5.4.190.0060.02112.63
5.4.180.0050.02112.63
5.4.170.0020.02312.63
5.4.160.0060.02012.63
5.4.150.0060.02112.63
5.4.140.0040.02412.47
5.4.130.0060.02212.47
5.4.120.0060.01912.45
5.4.110.0070.01712.45
5.4.100.0050.02112.44
5.4.90.0070.02512.44
5.4.80.0060.02412.44
5.4.70.0060.02112.44
5.4.60.0040.02212.44
5.4.50.0080.02012.44
5.4.40.0070.02312.43
5.4.30.0050.02412.43
5.4.20.0060.02212.43
5.4.10.0020.02412.43
5.4.00.0020.02412.18
5.3.290.0060.05212.80
5.3.280.0040.04112.71
5.3.270.0070.04612.73
5.3.260.0100.03612.71
5.3.250.0050.04012.72
5.3.240.0040.04012.71
5.3.230.0060.03912.71
5.3.220.0020.04212.68
5.3.210.0060.03912.68
5.3.200.0090.03912.68
5.3.190.0060.03812.68
5.3.180.0100.03212.68
5.3.170.0090.03412.67
5.3.160.0030.04012.67
5.3.150.0060.03812.67
5.3.140.0080.03512.66
5.3.130.0050.04012.66
5.3.120.0060.03912.65
5.3.110.0050.04212.66
5.3.100.0030.04012.13
5.3.90.0030.04012.13
5.3.80.0050.03712.09
5.3.70.0090.03412.09
5.3.60.0070.03812.08
5.3.50.0090.04712.02
5.3.40.0080.03612.02
5.3.30.0050.03611.98
5.3.20.0090.03311.77
5.3.10.0060.03511.73
5.3.00.0050.03711.72
5.2.170.0050.0379.22
5.2.160.0060.0309.21
5.2.150.0050.0349.22
5.2.140.0060.0339.21
5.2.130.0050.0289.17
5.2.120.0050.0329.18
5.2.110.0050.0349.18
5.2.100.0060.0289.18
5.2.90.0030.0309.17
5.2.80.0050.0309.18
5.2.70.0030.0329.17
5.2.60.0030.0329.13
5.2.50.0050.0309.10
5.2.40.0050.0299.07
5.2.30.0050.0299.05
5.2.20.0070.0279.04
5.2.10.0060.0288.95
5.2.00.0050.0288.81
5.1.60.0050.0268.09
5.1.50.0060.0308.08
5.1.40.0050.0278.07
5.1.30.0050.0298.42
5.1.20.0020.0308.44
5.1.10.0030.0278.16
5.1.00.0030.0288.16
5.0.50.0050.0196.64
5.0.40.0060.0266.51
5.0.30.0020.0376.31
5.0.20.0030.0206.28
5.0.10.0040.0196.26
5.0.00.0040.0316.26
4.4.90.0020.0164.77
4.4.80.0040.0134.76
4.4.70.0020.0164.76
4.4.60.0020.0164.75
4.4.50.0030.0154.77
4.4.40.0050.0244.71
4.4.30.0020.0164.76
4.4.20.0010.0174.84
4.4.10.0010.0174.85
4.4.00.0050.0234.76
4.3.110.0050.0174.67
4.3.100.0040.0144.66
4.3.90.0030.0174.64
4.3.80.0050.0304.58
4.3.70.0050.0184.63
4.3.60.0050.0184.63
4.3.50.0060.0184.63
4.3.40.0020.0254.54
4.3.30.0020.0173.30
4.3.20.0050.0153.28
4.3.10.0040.0143.24
4.3.00.0200.0138.12

preferences:
58.12 ms | 401 KiB | 5 Q