3v4l.org

run code in 300+ PHP versions simultaneously
<?php function nextAssoc($assoc) { if(false !== ($pos = strrpos($assoc, '01'))) { $assoc[$pos] = '1'; $assoc[$pos+1] = '0'; return substr($assoc, 0, $pos+2). str_repeat('0', substr_count(substr($assoc, $pos+2), '0')). str_repeat('1', substr_count(substr($assoc, $pos+2), '1')); } return false; } function getAssoc(array $data, $count=2, $split=true) { if(count($data)<$count) { return null; } $assoc = str_repeat('0', count($data)-$count).str_repeat('1', $count); $result = []; do { $result[]=array_intersect_key($data, array_filter(str_split($assoc))); } while($assoc=nextAssoc($assoc)); return $split?array_chunk($result, (int)(count($data)/$count)):$result; } $data = [1,2,3,4,5,6]; print_r(getAssoc($data, 2)); print_r(getAssoc($data, 3));

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.0160.00316.75
8.3.50.0130.00221.14
8.3.40.0110.00718.83
8.3.30.0090.00918.77
8.3.20.0070.00720.21
8.3.10.0030.00521.95
8.3.00.0080.00022.58
8.2.180.0110.00418.41
8.2.170.0100.01022.96
8.2.160.0040.01119.34
8.2.150.0000.00824.18
8.2.140.0090.00924.66
8.2.130.0120.00626.16
8.2.120.0070.00418.04
8.2.110.0070.00320.92
8.2.100.0080.00417.91
8.2.90.0000.00818.05
8.2.80.0050.00319.20
8.2.70.0000.00817.63
8.2.60.0040.00417.74
8.2.50.0090.00017.93
8.2.40.0060.00319.48
8.2.30.0000.00718.13
8.2.20.0030.00517.73
8.2.10.0030.00617.81
8.2.00.0000.00917.79
8.1.280.0090.00625.92
8.1.270.0090.00018.70
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0100.00019.16
8.1.230.0110.00019.11
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0000.00817.62
8.1.160.0040.00422.13
8.1.150.0000.00818.54
8.1.140.0000.00717.49
8.1.130.0060.00317.74
8.1.120.0040.00417.38
8.1.110.0000.00817.50
8.1.100.0040.00417.41
8.1.90.0040.00417.43
8.1.80.0050.00217.45
8.1.70.0000.00717.45
8.1.60.0060.00317.59
8.1.50.0040.00417.50
8.1.40.0030.00617.56
8.1.30.0040.00417.56
8.1.20.0040.00417.70
8.1.10.0000.00817.51
8.1.00.0050.00317.41
8.0.300.0040.00419.64
8.0.290.0040.00416.58
8.0.280.0030.00318.45
8.0.270.0040.00417.16
8.0.260.0040.00416.75
8.0.250.0000.00716.99
8.0.240.0080.00016.99
8.0.230.0000.00816.83
8.0.220.0020.00516.79
8.0.210.0040.00416.85
8.0.200.0030.00316.96
8.0.190.0040.00416.83
8.0.180.0000.00816.88
8.0.170.0070.00016.93
8.0.160.0000.00816.95
8.0.150.0000.00716.78
8.0.140.0040.00416.82
8.0.130.0060.00013.37
8.0.120.0000.00816.80
8.0.110.0000.00716.79
8.0.100.0040.00416.93
8.0.90.0050.00316.83
8.0.80.0100.00716.86
8.0.70.0000.00816.95
8.0.60.0020.00516.95
8.0.50.0040.00416.80
8.0.30.0150.00317.15
8.0.20.0060.01317.40
8.0.10.0050.00316.88
8.0.00.0090.00916.72
7.4.330.0030.00315.14
7.4.320.0060.00016.60
7.4.300.0000.00616.50
7.4.290.0030.00616.50
7.4.280.0000.00716.64
7.4.270.0000.00716.41
7.4.260.0100.00016.57
7.4.250.0050.00316.57
7.4.240.0000.00716.64
7.4.230.0050.00316.41
7.4.220.0080.00816.68
7.4.210.0090.00616.58
7.4.200.0000.00716.68
7.4.190.0040.00416.74
7.4.160.0080.00816.47
7.4.150.0040.01417.40
7.4.140.0110.01117.86
7.4.130.0110.00616.39
7.4.120.0050.01216.52
7.4.110.0110.00716.38
7.4.100.0120.01016.40
7.4.90.0070.01416.48
7.4.80.0200.00619.39
7.4.70.0090.00616.48
7.4.60.0150.00316.45
7.4.50.0000.00416.60
7.4.40.0100.00722.77
7.4.30.0120.00916.44
7.4.00.0060.00914.79
7.3.330.0030.00313.24
7.3.320.0000.00613.45
7.3.310.0000.00716.41
7.3.300.0030.00316.39
7.3.290.0140.00716.39
7.3.280.0060.01016.39
7.3.270.0100.00717.40
7.3.260.0090.01216.58
7.3.250.0110.00716.37
7.3.240.0120.00616.41
7.3.230.0110.00716.51
7.3.210.0110.00616.43
7.3.200.0100.01019.39
7.3.190.0090.00916.39
7.3.180.0190.01316.63
7.3.170.0100.00616.40
7.3.160.0150.00716.45
7.3.120.0140.00314.93
7.3.10.0030.01216.29
7.3.00.0000.00916.61
7.2.330.0090.00916.56
7.2.320.0060.01216.72
7.2.310.0090.01316.76
7.2.300.0080.00816.80
7.2.290.0110.00616.66
7.2.130.0060.00917.03
7.2.120.0080.00416.66
7.2.110.0060.00616.65
7.2.100.0000.01116.77
7.2.90.0090.00317.01
7.2.80.0030.01016.82
7.2.70.0060.00616.97
7.2.60.0100.00316.65
7.2.50.0100.00016.82
7.2.40.0030.01416.99
7.2.30.0000.01516.71
7.2.20.0040.01116.82
7.2.10.0040.01116.95
7.2.00.0060.00517.89
7.1.250.0030.00915.60
7.1.100.0050.00518.11
7.1.70.0000.00916.95
7.1.60.0030.01719.82
7.1.50.0110.01416.69
7.1.00.0030.07722.46
7.0.200.0070.00316.73
7.0.140.0130.07022.00
7.0.60.0030.05019.98
7.0.50.0070.06017.93
7.0.40.0170.08020.13
7.0.30.0170.04320.23
7.0.20.0400.04320.15
7.0.10.0170.07720.26
7.0.00.0130.08320.15
5.6.280.0070.07321.16
5.6.210.0100.08720.45
5.6.200.0000.07018.24
5.6.190.0030.07320.43
5.6.180.3470.03720.48
5.6.170.0430.07020.58
5.6.160.0100.07720.54
5.6.150.0170.07318.18
5.6.140.0270.07018.21
5.6.130.0070.08018.18
5.6.120.0130.08321.05
5.6.110.0200.08020.99
5.6.100.0130.07320.97
5.6.90.0130.07720.97
5.6.80.0030.04320.52
5.6.70.4270.03720.37
5.5.350.0030.09020.31
5.5.340.0130.08017.94
5.5.330.0170.07020.43
5.5.320.0300.03320.36
5.5.310.0370.04320.32
5.5.300.0030.08717.96
5.5.290.0100.07718.08
5.5.280.0200.07320.69
5.5.270.0000.04720.77
5.5.260.0100.06320.73
5.5.250.0200.08020.69
5.5.240.0070.03720.27
5.4.450.0900.06319.45
5.4.440.0870.05719.64
5.4.430.1070.05319.54
5.4.420.0470.05719.16
5.4.410.0170.06019.04
5.4.400.0630.06019.29
5.4.390.0530.06719.14
5.4.380.0300.06318.77
5.4.370.0270.04318.71
5.4.360.0400.03718.71
5.4.350.0090.04112.04
5.4.340.0190.03912.03
5.4.320.0110.04612.51
5.4.310.0190.04012.51
5.4.300.0180.03712.51
5.4.290.0140.04312.51
5.4.280.0080.04612.41
5.4.270.0170.03512.41
5.4.260.0150.03512.41
5.4.250.0170.05718.95
5.4.240.0400.05318.86
5.4.230.0130.07718.89
5.4.220.0170.05718.91
5.4.210.0100.05318.91
5.4.200.0200.04318.87
5.4.190.0200.04019.04
5.4.180.0170.05018.79
5.4.170.0130.05318.70
5.4.160.0130.05018.95
5.4.150.0200.05018.56
5.4.140.0070.05316.40
5.4.130.0070.05316.37
5.4.120.0070.05716.49
5.4.110.0130.04716.50
5.4.100.0130.05316.43
5.4.90.0170.04016.49
5.4.80.0070.06016.37
5.4.70.0230.04016.36
5.4.60.0200.04716.28
5.4.50.0170.04316.40
5.4.40.0100.05016.50
5.4.30.0100.04716.36
5.4.20.0170.04016.34
5.4.10.0130.04716.34
5.4.00.0170.05015.85
5.3.290.0140.05312.80
5.3.280.0100.04714.59
5.3.270.0070.05014.84
5.3.260.0100.05014.64
5.3.250.0100.04714.68
5.3.240.0030.05314.75
5.3.230.0100.04714.68
5.3.220.0000.05714.66
5.3.210.0070.05714.71
5.3.200.0030.05314.57
5.3.190.0030.05314.57
5.3.180.0030.05714.76
5.3.170.0130.04314.56
5.3.160.0070.05014.71
5.3.150.0070.05014.66
5.3.140.0130.04314.63
5.3.130.0030.05314.78
5.3.120.0070.05014.57
5.3.110.0100.05014.56
5.3.100.0100.05314.13
5.3.90.0100.04714.11
5.3.80.0070.05014.10
5.3.70.0070.04714.11
5.3.60.0100.04314.09
5.3.50.0030.05313.97
5.3.40.0070.05013.92
5.3.30.0130.04313.90
5.3.20.0030.05313.77
5.3.10.0070.04713.64
5.3.00.0130.05713.81
5.2.170.0070.06011.32
5.2.160.0070.03711.23
5.2.150.0070.04011.37
5.2.140.0070.04011.22
5.2.130.0100.05011.32
5.2.120.0030.05711.18
5.2.110.0130.03311.29
5.2.100.0070.03711.12
5.2.90.0000.04311.06
5.2.80.0000.04311.09
5.2.70.0100.05311.06
5.2.60.0070.04011.06
5.2.50.0070.04011.12
5.2.40.0000.04311.09
5.2.30.0100.03710.95
5.2.20.0030.04010.98
5.2.10.0030.04310.84
5.2.00.0070.03710.82
5.1.60.0030.0339.84
5.1.50.0030.03310.03
5.1.40.0030.0339.96
5.1.30.0000.03710.32
5.1.20.0030.04710.33
5.1.10.0000.03710.05
5.1.00.0000.03710.08
5.0.50.0030.0278.60
5.0.40.0000.0308.38
5.0.30.0030.0408.23
5.0.20.0030.0278.15
5.0.10.0030.0308.20
5.0.00.0030.0408.23
4.4.90.0000.0337.00
4.4.80.0000.0237.00
4.4.70.0100.0137.00
4.4.60.0070.0307.00
4.4.50.0000.0277.00
4.4.40.0030.0337.00
4.4.30.0030.0207.00
4.4.20.0000.0237.00
4.4.10.0000.0237.00
4.4.00.0030.0307.00
4.3.110.0070.0177.00
4.3.100.0030.0237.00
4.3.90.0030.0177.00
4.3.80.0000.0337.00
4.3.70.0100.0137.00
4.3.60.0000.0207.00
4.3.50.0070.0177.00
4.3.40.0070.0277.00
4.3.30.0000.0237.00
4.3.20.0000.0237.00
4.3.10.0030.0207.00
4.3.00.0130.0237.85

preferences:
39.24 ms | 400 KiB | 5 Q