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); if(is_array($arrays[0])) { $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) { foreach($array_merg as $arele2) { if(is_array($arele2)) { $tmp[] = array_merge(array($arele1),$arele2); } else { $tmp[] = array($arele1,$arele2); } } } return $tmp; } else { return $arrays; } } 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.63
8.3.50.0140.00522.04
8.3.40.0000.01418.45
8.3.30.0070.00719.21
8.3.20.0070.00020.16
8.3.10.0040.00423.61
8.3.00.0080.00019.13
8.2.180.0070.00718.02
8.2.170.0120.00622.96
8.2.160.0100.01020.47
8.2.150.0060.00324.18
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00422.25
8.2.110.0050.00522.17
8.2.100.0040.00817.72
8.2.90.0000.00719.21
8.2.80.0000.00918.05
8.2.70.0000.00917.50
8.2.60.0000.00818.05
8.2.50.0000.00918.07
8.2.40.0060.00318.34
8.2.30.0040.00418.21
8.2.20.0040.00417.76
8.2.10.0070.00018.03
8.2.00.0030.00717.71
8.1.280.0100.00725.92
8.1.270.0000.00823.97
8.1.260.0030.00726.35
8.1.250.0080.00028.09
8.1.240.0030.00623.77
8.1.230.0080.00318.97
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0040.00717.36
8.1.190.0060.00317.53
8.1.180.0000.00818.10
8.1.170.0040.00418.66
8.1.160.0030.00521.92
8.1.150.0040.00418.61
8.1.140.0050.00217.48
8.1.130.0030.00317.79
8.1.120.0070.00017.39
8.1.110.0030.00617.38
8.1.100.0040.00417.54
8.1.90.0000.00817.38
8.1.80.0040.00417.41
8.1.70.0040.00417.36
8.1.60.0030.00517.51
8.1.50.0060.00317.41
8.1.40.0050.00317.55
8.1.30.0050.00317.54
8.1.20.0040.00417.68
8.1.10.0000.00717.53
8.1.00.0000.00817.55
8.0.300.0000.00718.77
8.0.290.0040.00417.18
8.0.280.0000.00818.47
8.0.270.0070.00017.24
8.0.260.0030.00317.33
8.0.250.0000.00616.96
8.0.240.0040.00417.00
8.0.230.0000.00717.02
8.0.220.0000.00716.90
8.0.210.0030.00316.94
8.0.200.0000.00716.99
8.0.190.0070.00017.01
8.0.180.0040.00416.89
8.0.170.0050.00316.88
8.0.160.0040.00416.96
8.0.150.0000.00716.78
8.0.140.0030.00416.92
8.0.130.0060.00013.34
8.0.120.0000.00816.75
8.0.110.0040.00416.91
8.0.100.0050.00216.85
8.0.90.0030.00516.91
8.0.80.0040.01016.91
8.0.70.0040.00416.79
8.0.60.0050.00316.75
8.0.50.0040.00416.79
8.0.30.0110.00817.10
8.0.20.0100.01117.40
8.0.10.0040.00417.07
8.0.00.0090.01016.70
7.4.330.0030.00315.00
7.4.320.0030.00316.59
7.4.300.0000.00616.58
7.4.290.0000.00716.54
7.4.280.0030.00316.50
7.4.270.0060.00016.62
7.4.260.0000.00716.50
7.4.250.0040.00416.55
7.4.240.0010.00616.51
7.4.230.0020.00516.71
7.4.220.0100.00716.63
7.4.210.0080.00716.60
7.4.200.0040.00416.54
7.4.190.0030.00316.60
7.4.160.0120.00416.45
7.4.150.0150.00417.40
7.4.140.0090.01317.86
7.4.130.0110.00716.63
7.4.120.0090.00816.57
7.4.110.0100.00716.61
7.4.100.0070.01116.36
7.4.90.0120.00616.50
7.4.80.0150.00819.39
7.4.70.0170.00016.59
7.4.60.0090.00816.44
7.4.50.0050.00016.45
7.4.40.0060.00622.77
7.4.30.0030.01616.39
7.4.00.0130.00315.02
7.3.330.0000.00713.41
7.3.320.0030.00313.16
7.3.310.0000.00716.43
7.3.300.0000.00716.35
7.3.290.0100.00316.32
7.3.280.0090.00816.38
7.3.270.0200.00617.40
7.3.260.0070.01116.51
7.3.250.0090.01116.50
7.3.240.0100.01016.44
7.3.230.0070.01016.57
7.3.210.0130.00716.53
7.3.200.0080.01219.39
7.3.190.0160.00616.49
7.3.180.0070.01116.41
7.3.170.0060.01316.55
7.3.160.0070.01016.36
7.3.120.0060.00914.87
7.3.10.0100.00316.55
7.3.00.0060.00816.55
7.2.330.0030.01516.53
7.2.320.0080.01116.68
7.2.310.0090.01216.53
7.2.300.0090.01616.70
7.2.290.0120.01316.46
7.2.130.0080.00716.89
7.2.120.0050.01216.69
7.2.110.0120.00416.77
7.2.100.0090.00716.85
7.2.90.0050.01116.92
7.2.80.0060.01016.90
7.2.70.0060.00816.84
7.2.60.0070.00716.88
7.2.50.0080.00916.75
7.2.40.0070.00916.95
7.2.30.0090.00716.88
7.2.20.0070.00916.86
7.2.10.0050.01216.83
7.2.00.0050.01317.49
7.1.250.0060.00815.72
7.1.100.0030.01418.07
7.1.70.0100.00617.11
7.1.60.0060.00919.33
7.1.50.0060.00616.85
7.1.00.0100.07022.37
7.0.200.0360.00714.86
7.0.140.0000.07721.95
7.0.60.0030.07020.04
7.0.50.0030.06017.89
7.0.40.0070.04020.18
7.0.30.0270.07720.30
7.0.20.0130.04320.22
7.0.10.0070.05720.05
7.0.00.0170.08020.33
5.6.280.0030.07321.10
5.6.210.0200.06720.77
5.6.200.0030.07318.16
5.6.190.0170.03320.68
5.6.180.0130.04720.61
5.6.170.0300.04720.47
5.6.160.0130.08020.50
5.6.150.0070.08018.18
5.6.140.0030.06718.28
5.6.130.0030.04318.22
5.6.120.0370.05721.00
5.6.110.0070.07721.02
5.6.100.0170.05721.02
5.6.90.0030.08321.09
5.6.80.0130.06020.43
5.5.350.0030.08320.39
5.5.340.0030.08717.94
5.5.330.0030.06320.13
5.5.320.0230.05320.30
5.5.310.0300.04020.32
5.5.300.0070.04017.91
5.5.290.0000.08717.92
5.5.280.0030.09020.96
5.5.270.0170.07720.96
5.5.260.0230.06320.84
5.5.250.0000.08720.62
5.5.240.0070.07320.32
5.4.450.0270.03319.55
5.4.440.0300.04719.32
5.4.430.0130.06019.30
5.4.420.0200.04719.56
5.4.410.0200.05019.33
5.4.400.0400.02719.07
5.4.390.0300.03019.14
5.4.380.0300.05719.25
5.4.370.0170.06719.14
5.4.360.0100.04319.13
5.4.350.0200.04019.10
5.4.340.0230.04319.06
5.4.320.0430.05719.09
5.4.310.0200.03718.85
5.4.300.0270.04019.20
5.4.290.0300.07318.87
5.4.280.0090.04912.37
5.4.270.0110.05512.37
5.4.260.0150.07112.37
5.4.250.0120.05312.38
5.4.240.0070.05512.37
5.4.230.0070.06112.36
5.4.220.0110.05712.36
5.4.210.0040.05912.36
5.4.200.0080.04512.36
5.4.190.0100.05612.36
5.4.180.0180.05512.36
5.4.170.0120.05512.37
5.4.160.0120.05112.37
5.4.150.0040.05512.36
5.4.140.0070.05812.04
5.4.130.0130.04912.03
5.4.120.0090.05211.99
5.4.110.0060.05511.99
5.4.100.0070.05011.99
5.4.90.0110.05111.99
5.4.80.0090.05311.98
5.4.70.0060.05511.98
5.4.60.0090.05011.98
5.4.50.0080.05311.98
5.4.40.0100.05011.97
5.4.30.0060.05211.97
5.4.20.0140.04511.97
5.4.10.0070.04211.97
5.4.00.0060.04011.46
5.3.290.3430.03714.74
5.3.280.0100.05012.71
5.3.270.0110.04512.72
5.3.260.0140.05112.72
5.3.250.0060.03812.72
5.3.240.0070.03712.72
5.3.230.0050.04012.71
5.3.220.0070.04012.68
5.3.210.0040.06112.68
5.3.200.0110.05112.68
5.3.190.0080.05312.68
5.3.180.0060.04112.68
5.3.170.0080.04112.67
5.3.160.0100.04312.67
5.3.150.0110.04712.67
5.3.140.0120.04212.66
5.3.130.0070.04712.66
5.3.120.0060.04712.66
5.3.110.0090.04212.66
5.3.100.0060.04312.12
5.3.90.0120.04212.08
5.3.80.0080.04212.07
5.3.70.0090.04212.08
5.3.60.0030.04112.06
5.3.50.0090.04012.00
5.3.40.0080.05112.00
5.3.30.0120.05211.95
5.3.20.0050.04611.75
5.3.10.0080.05011.70
5.3.00.0100.04711.69
5.2.170.0060.0369.19
5.2.160.0040.0349.19
5.2.150.0070.0319.19
5.2.140.0050.0329.18
5.2.130.0050.0319.14
5.2.120.0060.0359.14
5.2.110.0070.0409.16
5.2.100.0050.0449.15
5.2.90.0050.0439.15
5.2.80.0060.0449.15
5.2.70.0060.0449.15
5.2.60.0060.0449.09
5.2.50.0050.0449.07
5.2.40.0080.0389.04
5.2.30.0070.0419.02
5.2.20.0070.0369.01
5.2.10.0080.0278.92
5.2.00.0040.0338.80
5.1.60.0090.0218.08
5.1.50.0070.0248.07
5.1.40.0050.0358.05
5.1.30.0120.0318.40
5.1.20.0100.0378.43
5.1.10.0080.0408.15
5.1.00.0070.0278.15
5.0.50.0050.0216.64
5.0.40.0060.0196.50
5.0.30.0050.0316.30
5.0.20.0050.0236.28
5.0.10.0090.0256.26
5.0.00.0050.0356.25
4.4.90.0020.0174.78
4.4.80.0030.0174.75
4.4.70.0030.0174.76
4.4.60.0030.0164.75
4.4.50.0030.0154.77
4.4.40.0030.0254.70
4.4.30.0030.0164.76
4.4.20.0030.0164.84
4.4.10.0050.0144.85
4.4.00.0030.0254.76
4.3.110.0030.0164.67
4.3.100.0030.0154.66
4.3.90.0030.0154.63
4.3.80.0060.0224.59
4.3.70.0040.0144.63
4.3.60.0040.0144.63
4.3.50.0010.0184.63
4.3.40.0020.0264.54
4.3.30.0030.0153.31
4.3.20.0020.0163.29
4.3.10.0020.0163.25
4.3.00.0100.02713.91

preferences:
43 ms | 401 KiB | 5 Q