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, $cond)], 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.0070.01018.53
8.3.50.0230.00721.25
8.3.40.0120.00318.79
8.3.30.0120.00619.17
8.3.20.0070.00020.38
8.3.10.0000.00723.61
8.3.00.0080.00019.38
8.2.180.0060.01518.18
8.2.170.0100.00722.96
8.2.160.0080.00818.97
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0060.00321.84
8.2.110.0060.00319.39
8.2.100.0060.00617.63
8.2.90.0050.00219.09
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0040.00419.82
8.2.30.0050.00518.04
8.2.20.0000.00717.78
8.2.10.0000.00718.09
8.2.00.0050.00317.73
8.1.280.0000.01425.92
8.1.270.0060.00323.96
8.1.260.0040.00426.35
8.1.250.0020.00528.09
8.1.240.0060.00322.14
8.1.230.0070.00322.67
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0040.00417.10
8.1.190.0000.00817.10
8.1.180.0090.00018.10
8.1.170.0040.00418.50
8.1.160.0040.00421.93
8.1.150.0000.00718.86
8.1.140.0000.00717.27
8.1.130.0070.00017.83
8.1.120.0040.00417.36
8.1.110.0040.00417.37
8.1.100.0000.00717.38
8.1.90.0070.00017.42
8.1.80.0050.00217.41
8.1.70.0070.00017.32
8.1.60.0070.00317.58
8.1.50.0040.00417.49
8.1.40.0030.00617.40
8.1.30.0040.00417.62
8.1.20.0040.00417.51
8.1.10.0030.00617.44
8.1.00.0040.00417.41
8.0.300.0030.00518.77
8.0.290.0000.00716.75
8.0.280.0030.00518.42
8.0.270.0000.00817.28
8.0.260.0030.00317.23
8.0.250.0070.00017.02
8.0.240.0000.00816.89
8.0.230.0030.00316.95
8.0.220.0070.00016.94
8.0.210.0030.00316.89
8.0.200.0060.00017.04
8.0.190.0040.00416.97
8.0.180.0070.00016.84
8.0.170.0040.00416.97
8.0.160.0030.00317.00
8.0.150.0040.00416.77
8.0.140.0000.00716.87
8.0.130.0030.00313.32
8.0.120.0030.00516.83
8.0.110.0020.00516.91
8.0.100.0000.00716.79
8.0.90.0000.00817.02
8.0.80.0120.00316.90
8.0.70.0030.00516.73
8.0.60.0040.00416.80
8.0.50.0040.00416.97
8.0.30.0150.00516.98
8.0.20.0140.01017.40
8.0.10.0070.00017.03
8.0.00.0140.00416.79
7.4.330.0050.00015.03
7.4.320.0040.00416.57
7.4.300.0030.00316.62
7.4.290.0040.00416.54
7.4.280.0040.00416.63
7.4.270.0030.00316.62
7.4.260.0030.00316.61
7.4.250.0000.00716.49
7.4.240.0060.00216.59
7.4.230.0000.00716.44
7.4.220.0130.00316.51
7.4.210.0120.00316.40
7.4.200.0030.00316.73
7.4.160.0150.00916.46
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0160.00716.54
7.4.120.0130.00416.48
7.4.110.0110.00716.47
7.4.100.0100.01016.68
7.4.90.0060.01116.55
7.4.80.0120.00919.39
7.4.70.0040.01816.40
7.4.60.0040.01516.52
7.4.50.0030.00516.35
7.4.40.0140.00316.53
7.4.30.0080.01216.45
7.4.10.0130.00716.35
7.4.00.0050.01115.68
7.3.330.0000.00613.33
7.3.320.0000.00513.33
7.3.310.0040.00416.34
7.3.300.0000.00716.33
7.3.290.0050.00916.34
7.3.280.0070.01116.33
7.3.270.0090.00917.40
7.3.260.0070.01016.28
7.3.250.0070.01016.57
7.3.240.0060.01016.32
7.3.230.0100.00716.40
7.3.210.0070.01016.31
7.3.200.0030.01319.39
7.3.190.0090.00916.32
7.3.180.0070.01016.52
7.3.170.0100.00716.64
7.3.160.0100.00716.47
7.3.130.0030.01716.50
7.3.120.0080.01015.48
7.3.110.0090.00815.52
7.3.100.0060.01215.41
7.3.90.0000.01215.58
7.3.80.0050.01215.49
7.3.70.0050.00815.52
7.3.60.0090.00515.48
7.3.50.0080.00915.41
7.3.40.0050.00715.36
7.3.30.0010.01015.56
7.3.20.0040.01217.32
7.3.10.0070.00617.14
7.3.00.0020.01016.96
7.2.330.0150.00816.52
7.2.320.0170.00316.62
7.2.310.0130.00316.29
7.2.300.0120.00616.64
7.2.290.0090.01216.63
7.2.260.0070.01316.63
7.2.250.0060.01315.76
7.2.240.0120.00515.66
7.2.230.0070.01115.47
7.2.220.0080.00815.54
7.2.210.0050.01215.84
7.2.200.0090.00515.68
7.2.190.0050.00915.44
7.2.180.0080.00715.53
7.2.170.0050.01015.60
7.2.160.0070.00715.72
7.2.150.0060.00917.64
7.2.140.0070.01117.43
7.2.130.0040.01017.28
7.2.120.0090.00617.29
7.2.110.0080.00917.06
7.2.100.0040.01117.28
7.2.90.0070.00617.32
7.2.80.0050.01017.07
7.2.70.0060.00717.34
7.2.60.0080.00717.06
7.2.50.0060.00717.25
7.2.40.0060.00917.07
7.2.30.0060.00617.20
7.2.20.0060.00817.07
7.2.10.0060.00617.17
7.2.00.0060.00817.64
7.1.330.0110.00616.47
7.1.320.0050.00816.32
7.1.310.0070.00816.43
7.1.300.0090.00316.57
7.1.290.0070.00716.42
7.1.280.0060.00616.39
7.1.270.0050.01016.39
7.1.260.0090.00616.47
7.1.250.0040.00916.21
7.1.240.0020.01016.05
7.1.230.0050.01016.12
7.1.220.0030.00816.25
7.1.210.0040.00716.08
7.1.200.0060.00915.96
7.1.190.0060.00916.13
7.1.180.0080.00516.20
7.1.170.0090.00516.19
7.1.160.0040.00916.10
7.1.150.0010.00916.16
7.1.140.0060.00516.06
7.1.130.0080.00516.30
7.1.120.0060.00916.18
7.1.110.0050.00816.25
7.1.100.0030.00916.59
7.1.90.0040.00916.18
7.1.80.0100.00416.27
7.1.70.0060.00516.50
7.1.60.0080.00716.95
7.1.50.0030.00716.42
7.1.40.0090.00416.15
7.1.30.0060.00616.22
7.1.20.0060.00716.13
7.1.10.0090.00616.23
7.1.00.0040.02717.70
7.0.330.0030.01015.85
7.0.320.0050.00715.84
7.0.310.0050.00715.82
7.0.300.0020.01015.94
7.0.290.0030.01015.92
7.0.280.0090.00415.76
7.0.270.0050.00915.85
7.0.260.0070.00415.80
7.0.250.0050.00715.91
7.0.240.0010.01115.96
7.0.230.0040.00715.95
7.0.220.0040.00915.89
7.0.210.0030.01116.00
7.0.200.0040.00815.95
7.0.190.0060.00715.85
7.0.180.0100.00315.89
7.0.170.0070.00815.86
7.0.160.0040.00815.78
7.0.150.0030.00915.72
7.0.140.0050.02317.53
7.0.130.0040.00915.73
7.0.120.0040.00815.94
7.0.110.0120.00515.96
7.0.100.0000.01315.88
7.0.90.0050.00915.89
7.0.80.0060.00515.96
7.0.70.0070.00815.87
7.0.60.0040.01616.88
7.0.50.0100.02316.44
7.0.40.0070.01515.47
7.0.30.0120.02015.44
7.0.20.0100.02015.53
7.0.10.0150.02615.47
7.0.00.0090.02515.52
5.6.400.0050.01015.08
5.6.390.0070.00715.04
5.6.380.0050.00614.67
5.6.370.0040.01014.62
5.6.360.0080.00514.92
5.6.350.0070.00414.58
5.6.340.0070.00814.81
5.6.330.0050.00614.69
5.6.320.0040.00814.81
5.6.310.0060.00814.67
5.6.300.0070.00614.81
5.6.290.0040.00814.92
5.6.280.0060.02716.27
5.6.270.0080.00514.71
5.6.260.0070.00614.87
5.6.250.0020.01414.71
5.6.240.0040.00914.87
5.6.230.0060.00714.61
5.6.220.0080.00714.73
5.6.210.0050.02416.23
5.6.200.0040.02315.71
5.6.190.0080.02716.05
5.6.180.0110.01616.25
5.6.170.0100.01816.20
5.6.160.0040.01716.25
5.6.150.0050.02015.64
5.6.140.0100.01615.60
5.6.130.0040.02515.69
5.6.120.0050.02816.31
5.6.110.0060.02116.29
5.6.100.0070.02116.30
5.6.90.0070.02716.30
5.6.80.0030.02416.15
5.6.70.0050.01716.09
5.6.60.0050.00914.77
5.6.50.0070.00814.71
5.6.40.0060.00814.78
5.6.30.0100.00514.65
5.6.20.0060.00714.78
5.6.10.0070.00714.61
5.6.00.0030.00914.65
5.5.380.0120.00213.63
5.5.370.0060.00713.68
5.5.360.0050.00513.63
5.5.350.0100.02315.37
5.5.340.0040.01814.72
5.5.330.0030.02815.29
5.5.320.0050.01915.27
5.5.310.0130.02215.33
5.5.300.0090.01914.72
5.5.290.0070.02614.77
5.5.280.0060.02615.45
5.5.270.0040.02515.54
5.5.260.0070.02115.44
5.5.250.0060.02315.40
5.5.240.0060.02315.28
5.5.230.0020.01013.52
5.5.220.0030.00713.53
5.5.210.0080.00413.66
5.5.200.0060.00513.54
5.5.190.0080.00313.57
5.5.180.0040.00613.54
5.5.170.0050.00813.58
5.5.160.0040.00613.50
5.5.150.0020.01013.58
5.5.140.0040.00913.47
5.5.130.0060.00613.45
5.5.120.0060.00713.65
5.5.110.0050.00613.47
5.5.100.0070.00513.61
5.5.90.0040.00513.62
5.5.80.0100.00413.75
5.5.70.0080.00613.56
5.5.60.0040.01013.74
5.5.50.0050.00713.40
5.5.40.0050.00613.33
5.5.30.0050.00813.52
5.5.20.0060.00713.63
5.5.10.0030.00913.46
5.5.00.0080.00513.52
5.4.450.0180.02413.58
5.4.440.0290.01713.46
5.4.430.0250.02113.51
5.4.420.0260.01713.59
5.4.410.0260.01613.54
5.4.400.0150.01813.42
5.4.390.0260.01913.28
5.4.380.0210.01913.47
5.4.370.0250.01913.41
5.4.360.0250.02013.47
5.4.350.0240.01713.30
5.4.340.0060.01211.64
5.4.330.0070.00411.42
5.4.320.0050.01411.71
5.4.310.0030.01411.80
5.4.300.0040.01511.72
5.4.290.0080.01011.78
5.4.280.0030.01411.57
5.4.270.0050.01311.76
5.4.260.0050.01311.71
5.4.250.0060.01511.68
5.4.240.0050.01211.75
5.4.230.0060.01411.75
5.4.220.0050.01311.62
5.4.210.0050.01311.70
5.4.200.0070.01411.73
5.4.190.0050.01511.69
5.4.180.0050.01511.65
5.4.170.0060.01311.81
5.4.160.0050.01511.68
5.4.150.0040.01711.65
5.4.140.0060.01711.63
5.4.130.0040.01511.66
5.4.120.0070.01311.65
5.4.110.0050.01511.65
5.4.100.0050.01311.62
5.4.90.0070.01611.60
5.4.80.0040.01511.58
5.4.70.0070.01211.57
5.4.60.0060.01211.51
5.4.50.0110.01011.62
5.4.40.0070.01211.62
5.4.30.0070.01311.60
5.4.20.0050.01411.57
5.4.10.0060.01311.61
5.4.00.0050.01411.42
5.3.290.0050.02111.44
5.3.280.0060.02011.32
5.3.270.0080.02011.53
5.3.260.0080.02111.51
5.3.250.0060.02011.40
5.3.240.0050.02411.47
5.3.230.0050.02311.50
5.3.220.0050.02211.46
5.3.210.0060.02111.44
5.3.200.0060.02011.45
5.3.190.0080.02111.47
5.3.180.0070.02011.44
5.3.170.0070.01811.44
5.3.160.0070.02011.58
5.3.150.0040.02211.47
5.3.140.0040.02211.57
5.3.130.0050.02311.49
5.3.120.0090.02211.36
5.3.110.0050.02711.50
5.3.100.0050.02111.21
5.3.90.0040.02511.28
5.3.80.0080.02311.18
5.3.70.0050.02011.07
5.3.60.0070.02011.20
5.3.50.0050.02111.15
5.3.40.0040.02111.00
5.3.30.0050.01811.04
5.3.20.0040.02710.91
5.3.10.0030.02110.79
5.3.00.0050.01910.93
5.2.170.0040.0219.36
5.2.160.0040.0189.30
5.2.150.0060.0189.29
5.2.140.0010.0229.27
5.2.130.0030.0189.24
5.2.120.0020.0209.25
5.2.110.0010.0219.25
5.2.100.0070.0149.25
5.2.90.0030.0199.22
5.2.80.0060.0209.13
5.2.70.0060.0169.23
5.2.60.0020.0219.14
5.2.50.0060.0169.12
5.2.40.0070.0159.24
5.2.30.0020.0199.15
5.2.20.0060.0149.07
5.2.10.0060.0189.00
5.2.00.0030.0178.90
5.1.60.0090.0128.07
5.1.50.0080.0128.06
5.1.40.0050.0128.28
5.1.30.0040.0158.47
5.1.20.0020.0178.44
5.1.10.0030.0168.29
5.1.00.0030.0168.16
5.0.50.0050.0107.18
5.0.40.0030.0127.10
5.0.30.0050.0187.00
5.0.20.0050.0096.99
5.0.10.0030.0116.98
5.0.00.0050.0166.97
4.4.90.0030.0096.24
4.4.80.0010.0116.22
4.4.70.0020.0116.23
4.4.60.0030.0106.22
4.4.50.0010.0116.23
4.4.40.0060.0126.20
4.4.30.0030.0116.23
4.4.20.0020.0116.27
4.4.10.0010.0116.27
4.4.00.0010.0176.23
4.3.110.0050.0086.18
4.3.100.0040.0106.18
4.3.90.0010.0136.16
4.3.80.0040.0206.14
4.3.70.0020.0116.16
4.3.60.0040.0096.16
4.3.50.0040.0096.16
4.3.40.0030.0136.11
4.3.30.0010.0105.50
4.3.20.0010.0115.49
4.3.10.0030.0095.47
4.3.00.0020.0127.91

preferences:
45.31 ms | 401 KiB | 5 Q