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_merge(array($arele1),$arele2); } 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.0100.01222.05
8.3.40.0120.00318.76
8.3.30.0040.01119.23
8.3.20.0080.00020.42
8.3.10.0070.00023.48
8.3.00.0080.00019.26
8.2.180.0060.01018.43
8.2.170.0090.00622.96
8.2.160.0110.00720.27
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0090.00926.16
8.2.120.0050.00221.99
8.2.110.0060.00322.08
8.2.100.0080.00418.03
8.2.90.0090.00019.21
8.2.80.0080.00018.03
8.2.70.0030.00517.50
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0000.00918.22
8.2.30.0000.00718.01
8.2.20.0070.00017.81
8.2.10.0080.00018.23
8.2.00.0000.01017.75
8.1.280.0130.00325.92
8.1.270.0000.00823.83
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0090.00023.75
8.1.230.0110.00019.08
8.1.220.0030.00517.79
8.1.210.0080.00018.77
8.1.200.0090.00017.23
8.1.190.0060.00317.55
8.1.180.0000.00818.10
8.1.170.0030.00518.63
8.1.160.0020.00521.94
8.1.150.0070.00018.68
8.1.140.0040.00417.44
8.1.130.0000.00717.74
8.1.120.0040.00417.48
8.1.110.0040.00417.46
8.1.100.0040.00417.38
8.1.90.0000.00717.37
8.1.80.0000.00717.50
8.1.70.0000.00717.43
8.1.60.0030.00517.60
8.1.50.0040.00417.34
8.1.40.0050.00317.43
8.1.30.0080.00017.62
8.1.20.0080.00017.68
8.1.10.0040.00417.55
8.1.00.0080.00017.49
8.0.300.0040.00418.77
8.0.290.0000.00717.16
8.0.280.0050.00318.46
8.0.270.0070.00017.16
8.0.260.0030.00317.27
8.0.250.0030.00316.96
8.0.240.0070.00016.98
8.0.230.0040.00416.92
8.0.220.0040.00416.92
8.0.210.0030.00316.89
8.0.200.0070.00016.85
8.0.190.0040.00416.88
8.0.180.0040.00416.98
8.0.170.0040.00416.87
8.0.160.0040.00416.88
8.0.150.0000.00716.84
8.0.140.0040.00416.74
8.0.130.0080.00013.34
8.0.120.0000.00716.73
8.0.110.0050.00316.90
8.0.100.0030.00516.89
8.0.90.0040.00416.86
8.0.80.0180.00316.82
8.0.70.0000.00816.69
8.0.60.0040.00416.80
8.0.50.0040.00416.86
8.0.30.0030.01717.13
8.0.20.0160.00517.41
8.0.10.0040.00416.81
8.0.00.0080.01116.85
7.4.330.0050.00015.00
7.4.320.0000.00716.51
7.4.300.0040.00416.61
7.4.290.0040.00416.65
7.4.280.0000.00716.50
7.4.270.0000.00716.43
7.4.260.0000.00816.45
7.4.250.0000.00716.45
7.4.240.0040.00316.58
7.4.230.0000.00716.57
7.4.220.0030.01316.54
7.4.210.0080.00916.60
7.4.200.0070.00016.30
7.4.190.0080.00016.77
7.4.160.0090.00616.38
7.4.150.0110.01117.40
7.4.140.0080.01317.86
7.4.130.0100.00716.53
7.4.120.0100.00716.54
7.4.110.0140.00916.50
7.4.100.0120.00916.61
7.4.90.0030.01516.48
7.4.80.0090.00919.39
7.4.70.0090.00816.58
7.4.60.0070.01016.57
7.4.50.0040.00416.54
7.4.40.0000.01722.77
7.4.30.0130.00316.38
7.4.00.0030.01014.88
7.3.330.0060.00013.21
7.3.320.0070.00013.32
7.3.310.0000.00816.43
7.3.300.0030.00316.25
7.3.290.0070.01316.33
7.3.280.0080.00816.31
7.3.270.0130.00817.40
7.3.260.0140.00316.37
7.3.250.0050.01716.40
7.3.240.0200.00016.51
7.3.230.0090.00916.39
7.3.210.0120.00616.55
7.3.200.0140.00919.39
7.3.190.0110.01216.58
7.3.180.0110.00516.59
7.3.170.0120.00316.73
7.3.160.0080.00816.34
7.3.120.0070.00715.01
7.2.330.0070.01116.50
7.2.320.0180.00616.50
7.2.310.0140.01216.69
7.2.300.0150.00616.57
7.2.290.0070.01116.63
7.2.00.0000.01019.03
7.1.100.0060.01018.09
7.1.70.0130.00016.90
7.1.60.0100.00719.33
7.1.50.0060.01617.02
7.1.00.0000.07022.33
7.0.200.0260.00714.86
7.0.140.0030.07722.08
7.0.60.0100.08019.84
7.0.50.0030.07017.81
7.0.40.0100.08020.05
7.0.30.0500.05720.20
7.0.20.0300.05020.06
7.0.10.0200.07720.06
7.0.00.0100.07320.14
5.6.210.0170.07720.73
5.6.200.0130.08318.18
5.6.190.0000.05720.61
5.6.180.0270.08320.47
5.6.170.0200.05020.57
5.6.160.0130.08020.44
5.6.150.0130.07318.25
5.6.140.0100.08318.16
5.6.130.0070.08318.18
5.6.120.0100.08321.12
5.6.110.0130.03721.04
5.6.100.0070.08320.97
5.6.90.0070.05020.98
5.6.80.0070.04320.54
5.6.70.4300.04020.40
5.5.350.0030.08320.35
5.5.340.0130.07717.96
5.5.330.0130.04020.43
5.5.320.0230.06020.31
5.5.310.0300.06720.27
5.5.300.0100.04317.97
5.5.290.0230.06717.95
5.5.280.0030.08720.68
5.5.270.0100.07020.98
5.5.260.0170.08020.78
5.5.250.0030.05720.62
5.5.240.0230.07320.19
5.4.450.0530.05719.54
5.4.440.1070.07319.59
5.4.430.0400.05719.70
5.4.420.0870.06319.46
5.4.410.0630.07319.03
5.4.400.0970.06019.23
5.4.390.0870.06319.15
5.4.380.0200.06018.75
5.4.370.0270.07018.76
5.4.360.0270.07018.57
5.4.350.0270.06018.81
5.4.340.0530.05318.74
5.4.320.0090.03612.51
5.4.310.0090.03812.50
5.4.300.0070.03812.50
5.4.290.0090.03712.50
5.4.280.0090.04212.37
5.4.270.0100.05212.37
5.4.260.0090.04212.37
5.4.250.0120.03612.37
5.4.240.0140.04412.38
5.4.230.0090.03712.36
5.4.220.0120.03412.37
5.4.210.0080.03712.36
5.4.200.0100.03912.36
5.4.190.0120.04812.36
5.4.180.0160.05112.36
5.4.170.0120.03312.37
5.4.160.0070.03912.36
5.4.150.0090.04312.36
5.4.140.0110.04212.05
5.4.130.0160.03812.03
5.4.120.0080.05611.99
5.4.110.0110.05411.98
5.4.100.0120.04011.99
5.4.90.0100.04511.98
5.4.80.0150.06411.99
5.4.70.0150.06111.98
5.4.60.0120.05011.98
5.4.50.0090.04911.98
5.4.40.0090.03411.97
5.4.30.0090.03811.96
5.4.20.0100.03511.96
5.4.10.0140.04811.97
5.4.00.0110.05111.46
5.3.290.0100.03912.80
5.3.280.0070.05312.70
5.3.270.0110.03712.72
5.3.260.0100.05412.72
5.3.250.0100.06112.72
5.3.240.0130.05112.72
5.3.230.0170.05212.70
5.3.220.0100.03912.68
5.3.210.0100.04312.68
5.3.200.0160.04312.68
5.3.190.0170.05612.68
5.3.180.0220.06112.67
5.3.170.0190.04212.67
5.3.160.0100.03912.67
5.3.150.0090.05812.67
5.3.140.0120.05412.66
5.3.130.0110.05512.66
5.3.120.0120.03912.66
5.3.110.0150.03512.66
5.3.100.0140.03812.12
5.3.90.0120.03612.08
5.3.80.0110.04312.07
5.3.70.0140.03612.08
5.3.60.0060.04212.06
5.3.50.0120.04812.00
5.3.40.0150.04312.00
5.3.30.0140.03411.95
5.3.20.0160.03411.74
5.3.10.0140.04111.70
5.3.00.0160.03911.69
5.2.170.0120.0409.19
5.2.160.0120.0429.19
5.2.150.0120.0459.19
5.2.140.0080.0489.18
5.2.130.0080.0309.15
5.2.120.0090.0279.14
5.2.110.0120.0269.16
5.2.100.0130.0329.15
5.2.90.0070.0379.15
5.2.80.0090.0429.15
5.2.70.0130.0419.14
5.2.60.0120.0439.09
5.2.50.0040.0489.07
5.2.40.0090.0529.04
5.2.30.0080.0429.03
5.2.20.0150.0399.01
5.2.10.0230.0508.92
5.2.00.0100.0468.79
5.1.60.0100.0358.08
5.1.50.0110.0348.07
5.1.40.0080.0448.05
5.1.30.0090.0278.40
5.1.20.0060.0308.43
5.1.10.0080.0268.16
5.1.00.0090.0358.15
5.0.50.0060.0246.64
5.0.40.0050.0276.50
5.0.30.0070.0346.30
5.0.20.0110.0356.28
5.0.10.0050.0326.26
5.0.00.0050.0446.25
4.4.90.0030.0264.78
4.4.80.0300.0544.75
4.4.70.0060.0214.75
4.4.60.0080.0184.75
4.4.50.0090.0424.77
4.4.40.0050.0344.71
4.4.30.0070.0224.76
4.4.20.0040.0264.84
4.4.10.0070.0284.85
4.4.00.0100.0344.76
4.3.110.0080.0464.66
4.3.100.0100.0354.66
4.3.90.0110.0334.63
4.3.80.0100.0314.58
4.3.70.0070.0224.63
4.3.60.0090.0304.62
4.3.50.0060.0254.63
4.3.40.0040.0344.54
4.3.30.0070.0263.31
4.3.20.0020.0243.29
4.3.10.0080.0203.25
4.3.00.0100.01313.47

preferences:
54.64 ms | 400 KiB | 5 Q