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)) { echo 'asds'; $tmp[] = array_unshift($arele2,$arele1); } else { $tmp[] = array($arele1,$arele2); } print_r($tmp); } } 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.0040.01116.50
8.3.50.0130.00821.99
8.3.40.0110.00318.96
8.3.30.0030.01219.04
8.3.20.0040.00420.09
8.3.10.0040.00423.70
8.3.00.0080.00019.38
8.2.180.0000.01518.41
8.2.170.0030.01022.96
8.2.160.0160.00318.95
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0070.00721.00
8.2.110.0060.00320.46
8.2.100.0060.00618.03
8.2.90.0000.00819.17
8.2.80.0030.00517.97
8.2.70.0030.00517.63
8.2.60.0080.00017.93
8.2.50.0060.00318.07
8.2.40.0040.00418.28
8.2.30.0000.00718.14
8.2.20.0040.00417.74
8.2.10.0080.00018.18
8.2.00.0000.01017.74
8.1.280.0100.00725.92
8.1.270.0000.00823.96
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0090.00023.98
8.1.230.0030.01017.42
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0100.00017.35
8.1.190.0070.00017.41
8.1.180.0000.00818.10
8.1.170.0080.00018.65
8.1.160.0070.00021.97
8.1.150.0000.00718.68
8.1.140.0000.00717.46
8.1.130.0000.00717.73
8.1.120.0000.00717.50
8.1.110.0040.00417.48
8.1.100.0000.00817.44
8.1.90.0040.00417.39
8.1.80.0070.00017.47
8.1.70.0070.00017.41
8.1.60.0040.00417.63
8.1.50.0060.00317.53
8.1.40.0000.00717.41
8.1.30.0050.00317.60
8.1.20.0040.00417.68
8.1.10.0000.00717.60
8.1.00.0000.00817.52
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0070.00018.44
8.0.270.0030.00317.20
8.0.260.0000.00617.25
8.0.250.0000.00616.84
8.0.240.0030.00516.99
8.0.230.0000.00716.90
8.0.220.0000.00716.83
8.0.210.0020.00516.79
8.0.200.0030.00316.95
8.0.190.0040.00416.94
8.0.180.0040.00416.81
8.0.170.0000.00716.94
8.0.160.0000.00716.89
8.0.150.0000.00716.86
8.0.140.0040.00416.87
8.0.130.0000.00613.33
8.0.120.0030.00516.88
8.0.110.0040.00416.86
8.0.100.0030.00616.70
8.0.90.0050.00216.78
8.0.80.0070.00716.82
8.0.70.0000.00816.96
8.0.60.0070.00016.96
8.0.50.0000.00716.91
8.0.30.0100.01017.25
8.0.20.0210.00617.40
8.0.10.0090.00016.83
8.0.00.0100.00816.84
7.4.330.0030.00315.00
7.4.320.0000.00616.63
7.4.300.0030.00316.45
7.4.290.0070.00016.59
7.4.280.0070.00016.64
7.4.270.0070.00016.65
7.4.260.0000.00716.42
7.4.250.0000.00716.37
7.4.240.0050.00216.48
7.4.230.0040.00316.55
7.4.220.0140.00316.57
7.4.210.0110.00516.57
7.4.200.0080.00016.41
7.4.190.0030.00616.74
7.4.160.0150.00016.62
7.4.150.0170.00617.40
7.4.140.0080.01317.86
7.4.130.0080.01016.37
7.4.120.0120.00416.54
7.4.110.0100.00716.54
7.4.100.0150.00616.63
7.4.90.0130.00316.61
7.4.80.0070.01019.39
7.4.70.0030.01316.59
7.4.60.0030.01316.43
7.4.50.0080.00016.61
7.4.40.0130.00322.77
7.4.30.0090.00916.43
7.4.00.0070.00714.74
7.3.330.0030.00313.33
7.3.320.0000.00813.39
7.3.310.0040.00416.37
7.3.300.0000.00716.39
7.3.290.0090.00916.29
7.3.280.0090.00916.31
7.3.270.0150.00917.40
7.3.260.0130.00316.47
7.3.250.0070.01016.47
7.3.240.0200.00316.65
7.3.230.0080.00816.40
7.3.210.0100.00716.32
7.3.200.0150.00619.39
7.3.190.0130.00316.49
7.3.180.0070.01016.47
7.3.170.0090.00616.62
7.3.160.0090.00916.51
7.3.120.0060.01016.89
7.3.110.0070.01016.89
7.3.100.0060.00916.89
7.3.90.0040.01116.89
7.3.80.0000.01416.89
7.3.70.0100.00716.89
7.3.60.0100.00316.89
7.3.50.0090.00616.89
7.3.40.0080.00816.89
7.3.30.0030.01216.89
7.3.20.0030.00916.89
7.3.10.0060.01016.68
7.3.00.0070.00716.58
7.2.330.0100.01016.47
7.2.320.0120.01216.94
7.2.310.0090.01116.77
7.2.300.0160.00716.84
7.2.290.0130.01016.52
7.2.240.0090.00616.89
7.2.230.0130.00316.89
7.2.220.0120.00316.89
7.2.210.0030.00616.89
7.2.200.0100.00716.89
7.2.190.0060.00916.89
7.2.180.0070.01016.89
7.2.170.0000.01716.89
7.2.160.0100.00716.89
7.2.150.0100.00316.89
7.2.140.0030.01016.98
7.2.130.0060.01216.72
7.2.120.0090.00716.89
7.2.110.0040.00816.92
7.2.100.0020.01316.95
7.2.90.0070.00316.92
7.2.80.0040.01116.84
7.2.70.0120.00716.82
7.2.60.0040.00916.92
7.2.50.0070.00316.94
7.2.40.0080.00616.91
7.2.30.0020.01216.88
7.2.20.0080.00716.90
7.2.10.0090.00916.86
7.2.00.0040.01216.92
7.1.330.0060.00616.89
7.1.320.0110.00416.89
7.1.310.0080.00816.89
7.1.300.0100.00716.89
7.1.290.0000.01416.89
7.1.280.0000.01616.89
7.1.270.0110.00416.89
7.1.260.0060.00916.89
7.1.250.0080.00716.33
7.1.200.0030.00715.79
7.1.70.0080.00817.23
7.1.60.0090.00919.33
7.1.50.0140.00716.93
7.1.00.0030.06722.28
7.0.200.0210.00615.04
7.0.140.0000.08021.95
7.0.110.0130.06019.98
7.0.100.0430.08320.16
7.0.90.0070.04020.08
7.0.80.0100.07319.97
7.0.70.0100.05020.11
7.0.60.0130.07020.06
7.0.50.0100.03719.99
7.0.40.0070.08019.65
7.0.30.0070.04719.74
7.0.20.0100.03719.70
7.0.10.0030.07719.63
7.0.00.0130.03019.77
5.6.280.0070.06721.04
5.6.260.0000.04320.70
5.6.250.0000.05020.69
5.6.240.0070.08020.70
5.6.230.0100.06720.55
5.6.220.0070.07020.65
5.6.210.0130.04020.82
5.6.200.0130.05720.71
5.6.190.0070.08020.66
5.6.180.0100.04720.60
5.6.170.0000.04720.56
5.6.160.0100.07020.60
5.6.150.0000.08020.64
5.6.140.0130.08020.68
5.6.130.0100.08020.85
5.6.120.0000.04320.71
5.6.110.0100.08320.55
5.6.100.0070.07320.65
5.6.90.0070.04320.64
5.6.80.0030.05020.01
5.6.70.0070.06019.96
5.6.60.0000.04319.82
5.6.50.0000.07320.02
5.6.40.0070.07020.21
5.6.30.0070.07020.01
5.6.20.0070.03320.00
5.6.10.0100.03719.82
5.6.00.0070.06319.99
5.5.380.0070.03317.63
5.5.370.0030.06317.55
5.5.360.0100.05717.54
5.5.350.0000.07317.50
5.5.340.0070.03718.10
5.5.330.0100.06018.10
5.5.320.0070.04018.23
5.5.310.0030.04018.13
5.5.300.0000.08717.93
5.5.290.0070.05718.13
5.5.280.0000.03718.09
5.5.270.0030.03717.90
5.5.260.0030.07017.93
5.5.250.0070.03318.04
5.5.240.0030.03317.61
5.5.230.0070.04317.61
5.5.220.0030.08017.50
5.5.210.0130.07017.63
5.5.200.0070.07017.48
5.5.190.0130.07017.18
5.5.180.0070.04017.27
5.5.160.0030.04317.27
5.5.150.0170.03017.48
5.5.140.0130.05017.28
5.5.130.0030.04717.27
5.5.120.0030.05317.27
5.5.110.0030.04017.48
5.5.100.0100.03317.16
5.5.90.0130.05317.34
5.5.80.0030.04317.29
5.5.70.0030.05317.29
5.5.60.0030.03317.34
5.5.50.0130.03317.07
5.5.40.0000.04317.47
5.5.30.0070.07017.46
5.5.20.0070.06317.14
5.5.10.0070.03717.14
5.5.00.0000.04717.32
5.4.450.0070.07019.56
5.4.440.0100.06719.51
5.4.430.0070.03719.49
5.4.420.0100.06719.35
5.4.410.0030.04019.23
5.4.400.0070.03319.34
5.4.390.0030.07019.18
5.4.380.0070.08319.18
5.4.370.0030.03319.03
5.4.360.0000.04719.24
5.4.350.0030.03319.23
5.4.340.0130.06319.23
5.4.320.0030.08019.34
5.4.310.0000.04319.00
5.4.300.0030.07719.09
5.4.290.0000.06719.00
5.4.280.0070.04019.00
5.4.270.0030.04019.00
5.4.260.0000.04719.31
5.4.250.0030.04019.23
5.4.240.0030.07319.13
5.4.230.0000.05019.00
5.4.220.0030.04019.22
5.4.210.0030.07019.14
5.4.200.0070.05718.95
5.4.190.0130.06019.16
5.4.180.0070.05319.17
5.4.170.0030.06719.13
5.4.160.0000.04319.00
5.4.150.0030.03319.30
5.4.140.0070.04316.34
5.4.130.0100.03016.54
5.4.120.0130.05316.53
5.4.110.0100.03716.41
5.4.100.0070.02716.55
5.4.90.0030.05016.31
5.4.80.0070.07016.64
5.4.70.0030.07716.57
5.4.60.0170.05716.52
5.4.50.0030.03716.53
5.4.40.0070.05316.68
5.4.30.0000.04016.32
5.4.20.0000.04016.40
5.4.10.0000.03716.35
5.4.00.0030.03315.77
5.3.290.0100.07714.70
5.3.280.0000.04014.63
5.3.270.0000.05014.62
5.3.260.0030.04014.63
5.3.250.0100.03014.75
5.3.240.0070.04014.75
5.3.230.0000.03714.57
5.3.220.0000.04314.71
5.3.210.0030.04014.80
5.3.200.0070.04714.60
5.3.190.0000.03714.56
5.3.180.0130.06714.56
5.3.170.0100.07314.60
5.3.160.0030.05014.79
5.3.150.0000.05014.57
5.3.140.0130.06714.70
5.3.130.0000.04314.56
5.3.120.0030.04014.69
5.3.110.0070.06714.55
5.3.100.0030.06014.05
5.3.90.0100.06714.15
5.3.80.0170.06714.15
5.3.70.0070.06014.05
5.3.60.0030.07014.01
5.3.50.0100.06714.04
5.3.40.0100.06714.02
5.3.30.0070.05013.98
5.3.20.0070.05313.68
5.3.10.0070.02713.62
5.3.00.0070.06013.63
5.2.170.0100.05011.96
5.2.160.0100.04011.96
5.2.150.0000.06011.96
5.2.140.0130.06011.96
5.2.130.0000.03011.96
5.2.120.0030.05311.96
5.2.110.0030.03011.96
5.2.100.0030.05011.96
5.2.90.0000.04311.96
5.2.80.0030.02311.96
5.2.70.0000.02711.96
5.2.60.0030.03311.96
5.2.50.0070.02711.96
5.2.40.0100.02011.96
5.2.30.0030.02311.96
5.2.20.0000.04311.96
5.2.10.0000.02711.96
5.2.00.0000.03011.96
5.1.60.0030.02311.96
5.1.50.0030.04711.96
5.1.40.0030.02011.96
5.1.30.0030.02711.96
5.1.20.0000.03011.96
5.1.10.0030.02711.96
5.1.00.0070.02011.96
5.0.50.0070.01311.96
5.0.40.0030.03011.96
5.0.30.0000.05011.96
5.0.20.0000.03311.96
5.0.10.0070.03311.96
5.0.00.0100.03011.96
4.4.90.0030.01311.96
4.4.80.0000.02311.96
4.4.70.0070.01011.96
4.4.60.0000.02011.96
4.4.50.0030.03311.96
4.4.40.0000.02711.96
4.4.30.0030.02711.96
4.4.20.0030.01311.96
4.4.10.0000.01711.96
4.4.00.0070.03311.96
4.3.110.0000.01311.96
4.3.100.0000.03011.96
4.3.90.0070.03011.96
4.3.80.0000.02711.96
4.3.70.0000.01711.96
4.3.60.0000.01711.96
4.3.50.0000.01711.96
4.3.40.0030.02311.96
4.3.30.0030.02711.96
4.3.20.0030.02311.96
4.3.10.0000.02311.96
4.3.00.0000.01711.96

preferences:
64.19 ms | 401 KiB | 5 Q