3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(array(1, 2), array(3, 4), array(5)); function get_combinations($arrays) { $result = array(array()); $count = count($arrays); $first_array = $arrays[0]; if($count > 2) { $array_merg = get_combinations(array_slice($arrays, 1)); } else { $array_merg = $arrays[1]; } $tmp = array(); foreach($first_array as $arele1) { //print_r($arele1); foreach($array_merg as $arele2) { //print_r($arele2); if(is_array($arele2)) { $tmp[] = array_unshift($arele2,$arele1); } else { $tmp[] = array($arele1,$arele2); } } } print_r($tmp); 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.0070.01416.63
8.3.50.0120.01022.13
8.3.40.0040.01118.84
8.3.30.0120.00619.13
8.3.20.0000.00820.37
8.3.10.0050.00323.48
8.3.00.0030.00519.25
8.2.180.0110.00718.29
8.2.170.0140.00022.96
8.2.160.0070.00720.47
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00022.11
8.2.110.0090.00020.32
8.2.100.0090.00317.72
8.2.90.0170.00317.80
8.2.80.0110.00017.97
8.2.70.0000.00917.63
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0000.00818.18
8.2.30.0080.00018.21
8.2.20.0000.00817.77
8.2.10.0000.00719.88
8.2.00.0120.00017.82
8.1.280.0180.00025.92
8.1.270.0060.00322.21
8.1.260.0000.00726.35
8.1.250.0070.00028.09
8.1.240.0030.00622.46
8.1.230.0040.00820.84
8.1.220.0000.00817.79
8.1.210.0060.00318.89
8.1.200.0040.00817.13
8.1.190.0000.00817.40
8.1.180.0000.00818.10
8.1.170.0040.00418.66
8.1.160.0000.00722.04
8.1.150.0040.00418.65
8.1.140.0040.00417.50
8.1.130.0030.00317.86
8.1.120.0000.00717.54
8.1.110.0080.00317.48
8.1.100.0040.00417.43
8.1.90.0000.00817.47
8.1.80.0050.00317.48
8.1.70.0040.00417.48
8.1.60.0000.00717.64
8.1.50.0040.00417.37
8.1.40.0030.00617.45
8.1.30.0040.00417.60
8.1.20.0050.00317.70
8.1.10.0040.00417.56
8.1.00.0000.00717.52
8.0.300.0030.00519.95
8.0.290.0040.00417.18
8.0.280.0020.00518.48
8.0.270.0000.00717.34
8.0.260.0000.00617.34
8.0.250.0000.00716.86
8.0.240.0030.00316.89
8.0.230.0030.00316.89
8.0.220.0000.00816.93
8.0.210.0070.00016.80
8.0.200.0000.00616.94
8.0.190.0090.00016.89
8.0.180.0040.00417.00
8.0.170.0040.00416.89
8.0.160.0030.00416.99
8.0.150.0070.00016.92
8.0.140.0000.00816.88
8.0.130.0000.00613.32
8.0.120.0080.00016.84
8.0.110.0000.00716.91
8.0.100.0000.00716.80
8.0.90.0000.00716.79
8.0.80.0000.01516.91
8.0.70.0080.00016.98
8.0.60.0040.00416.79
8.0.50.0040.00416.98
8.0.30.0120.01017.05
8.0.20.0130.00717.40
8.0.10.0020.00516.84
8.0.00.0080.01316.60
7.4.330.0030.00315.16
7.4.320.0030.00316.52
7.4.300.0060.00016.43
7.4.290.0080.00016.58
7.4.280.0000.00816.57
7.4.270.0000.00616.65
7.4.260.0070.00016.48
7.4.250.0000.00716.63
7.4.240.0040.00316.59
7.4.230.0030.00316.64
7.4.220.0000.02216.44
7.4.210.0060.00916.66
7.4.200.0000.00716.70
7.4.190.0000.00716.58
7.4.160.0120.00316.48
7.4.150.0030.01517.40
7.4.140.0150.00317.86
7.4.130.0060.01016.55
7.4.120.0090.00816.63
7.4.110.0100.00716.56
7.4.100.0110.00616.65
7.4.90.0170.00016.45
7.4.80.0140.00419.39
7.4.70.0130.00416.59
7.4.60.0100.01016.49
7.4.50.0000.00816.58
7.4.40.0040.01022.77
7.4.30.0000.01616.68
7.4.00.0030.01015.00
7.3.330.0050.00013.33
7.3.320.0030.00313.35
7.3.310.0000.00716.27
7.3.300.0000.00716.45
7.3.290.0130.00616.27
7.3.280.0080.01016.33
7.3.270.0150.00217.40
7.3.260.0080.00916.39
7.3.250.0090.00916.34
7.3.240.0170.00716.42
7.3.230.0100.00616.55
7.3.210.0000.02116.53
7.3.200.0110.01119.39
7.3.190.0070.01016.39
7.3.180.0100.00616.42
7.3.170.0060.01516.62
7.3.160.0030.01316.36
7.3.120.0000.01415.00
7.3.10.0030.01016.45
7.3.00.0000.01116.71
7.2.330.0150.00916.45
7.2.320.0120.00616.77
7.2.310.0100.00616.70
7.2.300.0090.00916.87
7.2.290.0160.00816.53
7.2.130.0030.00616.89
7.2.120.0040.01116.96
7.2.110.0060.00616.86
7.2.100.0000.01516.88
7.2.90.0060.00916.71
7.2.80.0040.01116.70
7.2.70.0030.01217.04
7.2.60.0090.00316.88
7.2.50.0030.01017.01
7.2.40.0100.00616.96
7.2.30.0040.00717.02
7.2.20.0110.00416.87
7.2.10.0030.00916.94
7.2.00.0050.00718.08
7.1.250.0060.00615.78
7.1.200.0060.00315.92
7.1.100.0060.00618.37
7.1.70.0060.00917.10
7.1.60.0100.01019.33
7.1.50.0090.01316.86
7.1.00.0070.07322.33
7.0.200.0140.00715.07
7.0.140.0030.07322.00
7.0.60.0030.04020.02
7.0.50.0070.04017.92
7.0.40.0070.04320.39
7.0.30.0330.07320.07
7.0.20.0300.08320.07
7.0.10.0100.07020.33
7.0.00.0000.04320.06
5.6.280.0070.07021.00
5.6.210.0070.07720.52
5.6.200.0030.04318.19
5.6.190.0000.06720.39
5.6.180.0230.08020.62
5.6.170.0200.08320.63
5.6.160.0130.07720.50
5.6.150.0030.05718.25
5.6.140.0070.08018.15
5.6.130.0130.03018.14
5.6.120.0270.02721.14
5.6.110.0000.04721.03
5.6.100.0130.07321.05
5.6.90.0170.06321.08
5.6.80.0030.06020.51
5.6.70.0570.03320.37
5.5.350.0130.07020.47
5.5.340.0030.08317.94
5.5.330.0170.08020.29
5.5.320.0230.08020.31
5.5.310.0500.06720.28
5.5.300.0100.04318.08
5.5.290.0030.07717.98
5.5.280.0070.07720.76
5.5.270.0030.07020.64
5.5.260.0030.07320.79
5.5.250.0030.08720.46
5.5.240.0230.07020.04
5.4.450.0670.05319.48
5.4.440.0970.05719.48
5.4.430.0770.06019.16
5.4.420.0730.05019.30
5.4.410.0770.05019.34
5.4.400.0770.05319.15
5.4.390.1130.06319.07
5.4.380.0970.05018.74
5.4.370.1000.05018.83
5.4.360.1000.05018.84
5.4.350.0900.05718.47
5.4.340.0800.05318.70
5.4.320.0060.04112.50
5.4.310.0120.03612.50
5.4.300.0050.04612.50
5.4.290.0060.03912.50
5.4.280.0100.04712.37
5.4.270.0050.05112.37
5.4.260.0170.08012.37
5.4.250.0160.05012.37
5.4.240.0090.03712.38
5.4.230.0070.04812.36
5.4.220.0110.04812.36
5.4.210.0060.03812.36
5.4.200.0050.04912.37
5.4.190.0090.04812.36
5.4.180.0100.04312.36
5.4.170.0080.03912.37
5.4.160.0110.03812.36
5.4.150.0110.04012.36
5.4.140.0070.04212.04
5.4.130.0140.05112.04
5.4.120.0060.04111.99
5.4.110.0060.03911.99
5.4.100.0070.03711.99
5.4.90.0100.03711.98
5.4.80.0050.04111.99
5.4.70.0100.03411.98
5.4.60.0060.03811.98
5.4.50.0090.03711.98
5.4.40.0080.04111.97
5.4.30.0100.04511.96
5.4.20.0120.05211.96
5.4.10.0100.04711.96
5.4.00.0090.05111.45
5.3.290.0080.05012.80
5.3.280.0090.05212.71
5.3.270.0070.04612.73
5.3.260.0090.04712.72
5.3.250.0110.03912.72
5.3.240.0100.05712.72
5.3.230.0100.06512.71
5.3.220.0070.04612.68
5.3.210.0070.07112.68
5.3.200.0160.04012.68
5.3.190.0070.05312.68
5.3.180.0250.05212.67
5.3.170.0110.03812.67
5.3.160.0070.03612.67
5.3.150.0090.03612.67
5.3.140.0080.03512.66
5.3.130.0090.04112.66
5.3.120.0080.03812.66
5.3.110.0060.04112.66
5.3.100.0060.03912.12
5.3.90.0050.04012.09
5.3.80.0090.03612.08
5.3.70.0100.04412.07
5.3.60.0060.04212.07
5.3.50.0100.03612.00
5.3.40.0100.04512.00
5.3.30.0110.03311.96
5.3.20.0060.03811.75
5.3.10.0060.03611.70
5.3.00.0060.03811.70
5.2.170.0040.0339.19
5.2.160.0080.0339.19
5.2.150.0110.0259.19
5.2.140.0050.0319.19
5.2.130.0090.0279.14
5.2.120.0040.0329.15
5.2.110.0050.0309.15
5.2.100.0050.0299.15
5.2.90.0080.0339.14
5.2.80.0050.0329.14
5.2.70.0080.0289.14
5.2.60.0050.0309.09
5.2.50.0060.0309.07
5.2.40.0100.0269.04
5.2.30.0080.0489.02
5.2.20.0080.0309.01
5.2.10.0090.0268.92
5.2.00.0090.0268.79
5.1.60.0040.0268.07
5.1.50.0050.0278.07
5.1.40.0080.0268.05
5.1.30.0060.0278.39
5.1.20.0060.0288.42
5.1.10.0080.0258.15
5.1.00.0050.0328.14
5.0.50.0030.0236.63
5.0.40.0050.0196.50
5.0.30.0050.0316.30
5.0.20.0050.0196.28
5.0.10.0040.0216.26
5.0.00.0050.0316.24
4.4.90.0030.0164.78
4.4.80.0020.0174.75
4.4.70.0040.0184.75
4.4.60.0030.0164.75
4.4.50.0030.0154.77
4.4.40.0050.0264.71
4.4.30.0030.0234.76
4.4.20.0030.0174.85
4.4.10.0040.0164.85
4.4.00.0010.0284.76
4.3.110.0020.0174.67
4.3.100.0050.0134.66
4.3.90.0020.0164.63
4.3.80.0030.0254.59
4.3.70.0010.0174.63
4.3.60.0020.0244.63
4.3.50.0040.0224.63
4.3.40.0040.0354.54
4.3.30.0040.0223.31
4.3.20.0020.0233.30
4.3.10.0020.0223.25
4.3.00.0230.01310.37

preferences:
36 ms | 401 KiB | 5 Q