3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('A' => array(1, 2), 'B' => array(3, 4), 'C' => array(5)); function get_combinations($arrays) { $result = array(array()); $count = count($arrays); if($count > 2) { $array_merg = get_combinations(array_slice($arrays, 1)); } else { $array_merg = $arrays[1]; } $tmp = array(); foreach($arrays[0] as $arele1) { foreach($array_merg as $arele2) { if(is_array($arele2)) { $tmp[] = array_unshift($arele2,$arele1); } else { $tmp[] = array($arele1,$arele2); } } } return $tmp; } var_dump(get_combinations($a));

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.0130.00916.75
8.3.50.0110.00721.94
8.3.40.0120.00318.67
8.3.30.0070.00718.96
8.3.20.0040.00420.29
8.3.10.0000.00723.61
8.3.00.0040.00419.13
8.2.180.0100.01016.88
8.2.170.0070.00722.96
8.2.160.0030.01020.39
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0000.00822.25
8.2.110.0060.00322.13
8.2.100.0080.00417.94
8.2.90.0080.00019.21
8.2.80.0060.00318.04
8.2.70.0040.00417.63
8.2.60.0000.00818.05
8.2.50.0040.00418.07
8.2.40.0100.00018.22
8.2.30.0070.00018.05
8.2.20.0040.00417.82
8.2.10.0040.00418.01
8.2.00.0000.00817.76
8.1.280.0060.00925.92
8.1.270.0050.00323.96
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00023.94
8.1.230.0110.00019.07
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.39
8.1.180.0000.00818.10
8.1.170.0000.00818.55
8.1.160.0000.00722.02
8.1.150.0040.00418.61
8.1.140.0000.00817.47
8.1.130.0070.00017.89
8.1.120.0040.00417.47
8.1.110.0070.00317.52
8.1.100.0030.00317.39
8.1.90.0000.00717.45
8.1.80.0000.00717.40
8.1.70.0000.00817.42
8.1.60.0040.00417.64
8.1.50.0000.00717.51
8.1.40.0030.00517.55
8.1.30.0000.00817.58
8.1.20.0040.00417.66
8.1.10.0000.00817.42
8.1.00.0030.00617.43
8.0.300.0000.00718.77
8.0.290.0030.00616.93
8.0.280.0030.00318.46
8.0.270.0070.00017.29
8.0.260.0080.00017.25
8.0.250.0030.00517.02
8.0.240.0050.00216.90
8.0.230.0030.00516.94
8.0.220.0000.00817.00
8.0.210.0000.00817.01
8.0.200.0030.00316.91
8.0.190.0000.00716.88
8.0.180.0000.00716.98
8.0.170.0030.00516.98
8.0.160.0000.00916.85
8.0.150.0070.00017.01
8.0.140.0030.00316.91
8.0.130.0000.00513.30
8.0.120.0040.00416.95
8.0.110.0000.00817.03
8.0.100.0000.00716.96
8.0.90.0080.00016.77
8.0.80.0060.01316.92
8.0.70.0000.00716.84
8.0.60.0000.00816.96
8.0.50.0000.00716.81
8.0.30.0090.00916.98
8.0.20.0110.00817.42
8.0.10.0000.00716.94
8.0.00.0090.01016.60
7.4.330.0020.00215.00
7.4.320.0000.00716.50
7.4.300.0030.00316.41
7.4.290.0030.00316.63
7.4.280.0000.00816.51
7.4.270.0070.00016.48
7.4.260.0040.00416.44
7.4.250.0050.00216.57
7.4.240.0030.00316.55
7.4.230.0030.00316.73
7.4.220.0090.00916.71
7.4.210.0060.01216.54
7.4.200.0070.00016.36
7.4.190.0000.00716.42
7.4.160.0100.00616.58
7.4.150.0110.00717.40
7.4.140.0050.01217.86
7.4.130.0070.01116.72
7.4.120.0100.01016.52
7.4.110.0030.01316.49
7.4.100.0120.00816.72
7.4.90.0150.00616.39
7.4.80.0170.00519.39
7.4.70.0030.01316.64
7.4.60.0070.01016.50
7.4.50.0000.00816.25
7.4.40.0060.01022.77
7.4.30.0060.01016.55
7.4.00.0060.00815.07
7.3.330.0030.00313.43
7.3.320.0000.00613.45
7.3.310.0070.00016.28
7.3.300.0000.00716.49
7.3.290.0030.01016.38
7.3.280.0050.01416.36
7.3.270.0110.00517.40
7.3.260.0150.00916.58
7.3.250.0050.01316.43
7.3.240.0160.00616.51
7.3.230.0110.00616.39
7.3.210.0140.00416.52
7.3.200.0070.01719.39
7.3.190.0070.01016.23
7.3.180.0080.00816.56
7.3.170.0060.01216.56
7.3.160.0060.01016.48
7.3.120.0090.00714.99
7.3.110.0070.01014.70
7.3.100.0030.01015.06
7.3.90.0090.00914.91
7.3.80.0100.01014.87
7.3.70.0000.01014.95
7.3.60.0030.01014.70
7.3.50.0090.00614.91
7.3.40.0040.00414.96
7.3.30.0100.00314.79
7.3.20.0070.01116.57
7.3.10.0030.01316.87
7.3.00.0040.01116.52
7.2.330.0090.00916.78
7.2.320.0110.00716.82
7.2.310.0090.01616.69
7.2.300.0130.00716.47
7.2.290.0160.00016.79
7.2.250.0080.00815.04
7.2.240.0060.01315.30
7.2.230.0090.00615.02
7.2.220.0070.00715.23
7.2.210.0070.01014.90
7.2.200.0100.00315.24
7.2.190.0060.00315.22
7.2.180.0030.01315.19
7.2.170.0030.00914.97
7.2.00.0040.00719.19
7.1.330.0100.00315.79
7.1.320.0070.00715.79
7.1.310.0070.01315.74
7.1.300.0040.00715.87
7.1.290.0080.00315.99
7.1.280.0090.00315.93
7.1.270.0060.00615.75
7.1.260.0040.00715.77
7.1.100.0000.01118.09
7.1.70.0100.00317.09
7.1.60.0070.01719.33
7.1.50.0070.01517.02
7.1.00.0030.07722.57
7.0.200.0220.00614.71
7.0.140.0100.06322.21
7.0.60.0100.08020.04
7.0.50.0100.07317.96
7.0.40.0070.04020.09
7.0.30.0230.05720.12
7.0.20.0230.04320.15
7.0.10.0100.06320.16
7.0.00.0100.07720.27
5.6.280.0030.07321.12
5.6.210.0300.07020.61
5.6.200.0030.04318.29
5.6.190.0270.07020.61
5.6.180.0130.03720.49
5.6.170.0270.08020.52
5.6.160.0100.05320.52
5.6.150.0070.08318.29
5.6.140.0100.05718.18
5.6.130.0030.06318.15
5.6.120.0130.08021.13
5.6.110.0130.07721.02
5.6.100.0030.08321.02
5.6.90.0030.07020.88
5.6.80.0030.03720.54
5.5.350.0070.08020.41
5.5.340.0070.08017.96
5.5.330.0070.04320.35
5.5.320.0270.06720.24
5.5.310.0370.07320.27
5.5.300.0100.03318.08
5.5.290.0130.07717.95
5.5.280.0100.06320.82
5.5.270.0130.04320.73
5.5.260.0070.08720.81
5.5.250.0170.06020.70
5.5.240.0070.05020.26
5.4.450.0200.04319.57
5.4.440.0230.09019.40
5.4.430.0200.05319.47
5.4.420.0170.05319.40
5.4.410.0200.08319.04
5.4.400.0230.03719.14
5.4.390.0200.04018.87
5.4.380.0230.08019.22
5.4.370.0330.05319.06
5.4.360.0230.04319.27
5.4.350.0230.03719.15
5.4.340.0300.06318.88
5.4.320.0500.05018.95
5.4.310.0370.03719.08
5.4.300.0330.06019.22
5.4.290.0230.03719.21
5.4.280.0080.06912.38
5.4.270.0130.07012.38
5.4.260.0190.08912.37
5.4.250.0120.07312.37
5.4.240.0190.06812.38
5.4.230.0110.07412.36
5.4.220.0070.06312.36
5.4.210.0150.07312.36
5.4.200.0130.05312.36
5.4.190.0100.05412.36
5.4.180.0150.08112.36
5.4.170.0130.07912.37
5.4.160.0130.05112.36
5.4.150.0120.06012.36
5.4.140.0110.05912.05
5.4.130.0110.04512.03
5.4.120.0070.05111.99
5.4.110.0070.04311.99
5.4.100.0110.05511.98
5.4.90.0100.04411.98
5.4.80.0160.06111.98
5.4.70.0120.06011.98
5.4.60.0110.05511.98
5.4.50.0090.03811.98
5.4.40.0080.03611.97
5.4.30.0120.03311.97
5.4.20.0090.03811.97
5.4.10.0080.04611.97
5.4.00.0050.04411.46
5.3.290.4300.04314.57
5.3.280.0120.04512.71
5.3.270.0100.05412.73
5.3.260.0090.04212.72
5.3.250.0110.05212.72
5.3.240.0120.04312.72
5.3.230.0080.04112.70
5.3.220.0090.04412.68
5.3.210.0080.04312.68
5.3.200.0270.07912.68
5.3.190.0110.07812.68
5.3.180.0120.06512.68
5.3.170.0100.07712.67
5.3.160.0100.05212.67
5.3.150.0240.07812.68
5.3.140.0100.05712.66
5.3.130.0160.06512.66
5.3.120.0120.06112.66
5.3.110.0090.06012.66
5.3.100.0140.06012.11
5.3.90.0110.10012.09
5.3.80.0150.07212.07
5.3.70.0200.07812.07
5.3.60.0150.07512.06
5.3.50.0100.06112.01
5.3.40.0120.05212.00
5.3.30.0070.05911.96
5.3.20.0090.05211.75
5.3.10.0160.05711.70
5.3.00.0170.07611.69
5.2.170.0120.0609.18
5.2.160.0100.0609.19
5.2.150.0060.0489.19
5.2.140.0050.0479.19
5.2.130.0120.0429.15
5.2.120.0070.0759.14
5.2.110.0050.0479.15
5.2.100.0070.0479.15
5.2.90.0150.0579.15
5.2.80.0100.0589.14
5.2.70.0110.0509.14
5.2.60.0150.0709.09
5.2.50.0060.0319.06
5.2.40.0030.0339.04
5.2.30.0080.0359.02
5.2.20.0060.0319.01
5.2.10.0040.0438.93
5.2.00.0070.0338.79
5.1.60.0070.0258.07
5.1.50.0100.0358.07
5.1.40.0050.0298.05
5.1.30.0210.0598.40
5.1.20.0100.0328.43
5.1.10.0120.0848.15
5.1.00.0130.0588.15
5.0.50.0070.0296.63
5.0.40.0150.0556.50
5.0.30.0100.0566.30
5.0.20.0080.0236.28
5.0.10.0090.0376.26
5.0.00.0050.0376.25
4.4.90.0080.0454.78
4.4.80.0140.0614.75
4.4.70.0160.0354.76
4.4.60.0100.0414.75
4.4.50.0100.0394.77
4.4.40.0110.0434.71
4.4.30.0060.0434.76
4.4.20.0110.0824.84
4.4.10.0060.0234.85
4.4.00.0180.0524.76
4.3.110.0080.0394.67
4.3.100.0060.0404.67
4.3.90.0080.0324.63
4.3.80.0120.0484.58
4.3.70.0090.0284.63
4.3.60.0100.0374.63
4.3.50.0070.0204.63
4.3.40.0030.0254.54
4.3.30.0040.0213.30
4.3.20.0060.0263.29
4.3.10.0030.0223.25
4.3.00.0100.02013.91

preferences:
41.93 ms | 401 KiB | 5 Q