3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.60.0070.00717.01
7.2.00.0030.01019.36
7.1.200.0140.00015.86
7.1.100.0030.01217.93
7.1.70.0030.00316.87
7.1.60.0070.01719.33
7.1.50.0130.00917.06
7.1.00.0070.06322.33
7.0.200.0210.00915.00
7.0.140.0030.07322.18
7.0.60.0100.08019.95
7.0.50.0070.07017.91
7.0.40.0070.04320.24
7.0.30.0500.06720.23
7.0.20.0230.07020.10
7.0.10.0070.06020.07
7.0.00.0100.08320.12
5.6.280.0030.07720.99
5.6.210.0030.07020.55
5.6.200.0130.08018.16
5.6.190.0100.05320.67
5.6.180.0100.08720.64
5.6.170.0270.05320.53
5.6.160.0130.07320.65
5.6.150.0030.05718.16
5.6.140.0000.09018.22
5.6.130.0070.05318.16
5.6.120.0000.04720.99
5.6.110.0170.07020.98
5.6.100.0100.08020.98
5.6.90.0200.07721.02
5.6.80.0100.07020.41
5.6.70.4530.04020.40
5.5.350.0130.07720.47
5.5.340.0030.04717.91
5.5.330.0030.05320.41
5.5.320.0300.04020.36
5.5.310.0200.05020.28
5.5.300.0030.08317.95
5.5.290.0030.05317.97
5.5.280.0070.08320.74
5.5.270.0130.08320.65
5.5.260.0100.08020.76
5.5.250.0100.08020.55
5.5.240.0200.07720.29
5.4.450.0770.05719.61
5.4.440.0970.05019.47
5.4.430.0770.07019.45
5.4.420.0200.05019.54
5.4.410.0670.06019.25
5.4.400.0100.06719.01
5.4.390.0870.04719.22
5.4.380.0470.04718.47
5.4.370.0570.06018.61
5.4.360.0370.04718.45
5.4.350.0300.06318.47
5.4.340.0300.06318.84
5.4.320.0070.03712.50
5.4.310.0080.04112.50
5.4.300.0080.03712.51
5.4.290.0080.04012.50
5.4.280.0130.04412.37
5.4.270.0110.03812.37
5.4.260.0050.04312.37
5.4.250.0110.03512.37
5.4.240.0090.03612.37
5.4.230.0120.04512.36
5.4.220.0100.04312.36
5.4.210.0160.03912.36
5.4.200.0100.03912.36
5.4.190.0110.05212.36
5.4.180.0160.05012.36
5.4.170.0110.03612.37
5.4.160.0180.03612.36
5.4.150.0120.04612.36
5.4.140.0090.03912.04
5.4.130.0080.03512.03
5.4.120.0050.03711.99
5.4.110.0090.03611.99
5.4.100.0110.04311.99
5.4.90.0050.04211.98
5.4.80.0120.05411.98
5.4.70.0100.05011.98
5.4.60.0060.05411.98
5.4.50.0110.04011.98
5.4.40.0120.05011.97
5.4.30.0160.06011.96
5.4.20.0120.04711.96
5.4.10.0130.03111.96
5.4.00.0060.04011.45
5.3.290.0070.04612.80
5.3.280.0150.04012.71
5.3.270.0130.08312.73
5.3.260.0160.05212.72
5.3.250.0210.05912.72
5.3.240.0090.03712.72
5.3.230.0100.04112.71
5.3.220.0110.04012.68
5.3.210.0150.04712.68
5.3.200.0060.04012.68
5.3.190.0090.04012.68
5.3.180.0120.04512.68
5.3.170.0110.03812.67
5.3.160.0150.03612.68
5.3.150.0100.04012.68
5.3.140.0140.05212.66
5.3.130.0130.04512.66
5.3.120.0100.04312.66
5.3.110.0080.05712.66
5.3.100.0100.03712.12
5.3.90.0130.03612.08
5.3.80.0070.04212.08
5.3.70.0070.04012.08
5.3.60.0140.03712.07
5.3.50.0190.04312.01
5.3.40.0090.04312.00
5.3.30.0160.04211.96
5.3.20.0130.03911.74
5.3.10.0060.04711.70
5.3.00.0110.05911.70
5.2.170.0100.0449.19
5.2.160.0120.0419.19
5.2.150.0110.0429.19
5.2.140.0090.0439.18
5.2.130.0080.0309.14
5.2.120.0110.0269.14
5.2.110.0060.0319.15
5.2.100.0100.0329.16
5.2.90.0080.0319.15
5.2.80.0100.0309.15
5.2.70.0100.0309.14
5.2.60.0110.0449.09
5.2.50.0090.0369.08
5.2.40.0100.0359.04
5.2.30.0110.0279.02
5.2.20.0090.0329.01
5.2.10.0100.0288.92
5.2.00.0070.0318.79
5.1.60.0110.0208.07
5.1.50.0080.0318.07
5.1.40.0070.0308.06
5.1.30.0070.0358.40
5.1.20.0060.0298.43
5.1.10.0050.0298.16
5.1.00.0110.0298.15
5.0.50.0100.0206.64
5.0.40.0060.0336.50
5.0.30.0070.0436.30
5.0.20.0070.0226.28
5.0.10.0060.0246.26
5.0.00.0080.0416.25
4.4.90.0050.0194.78
4.4.80.0110.0184.75
4.4.70.0070.0224.75
4.4.60.0080.0204.75
4.4.50.0060.0164.77
4.4.40.0090.0234.71
4.4.30.0090.0164.76
4.4.20.0120.0194.85
4.4.10.0040.0194.84
4.4.00.0120.0254.76
4.3.110.0090.0144.67
4.3.100.0060.0184.66
4.3.90.0060.0214.63
4.3.80.0100.0254.59
4.3.70.0070.0184.63
4.3.60.0060.0214.63
4.3.50.0080.0214.63
4.3.40.0080.0314.54
4.3.30.0060.0183.31
4.3.20.0100.0193.30
4.3.10.0040.0173.25
4.3.00.0400.02010.37