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($count > 2) { $array_merg = get_combinations(array_slice($arrays, 1)); } else { $array_merg = $arrays[1]; } print_r($arrays[0]); print_r($array_merg); $tmp = array(); foreach($arrays[0] as $arele1) { foreach($array_merg as $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)
5.4.280.0100.03812.38
5.4.270.0070.04212.38
5.4.260.0070.05612.38
5.4.250.0160.08412.38
5.4.240.0400.07612.38
5.4.230.0100.05512.38
5.4.220.0060.05412.38
5.4.210.0050.04312.37
5.4.200.0170.05012.37
5.4.190.0330.08512.37
5.4.180.0090.03912.37
5.4.170.0090.04312.38
5.4.160.0210.08412.38
5.4.150.0140.05212.37
5.4.140.0100.06912.06
5.4.130.0120.05812.04
5.4.120.0150.07812.00
5.4.110.0120.06912.00
5.4.100.0100.05512.00
5.4.90.0180.09712.00
5.4.80.0150.06812.00
5.4.70.0320.13112.00
5.4.60.0270.09312.00
5.4.50.0090.05712.00
5.4.40.0090.03911.99
5.4.30.0100.04711.98
5.4.20.0050.04011.98
5.4.10.0100.03411.98
5.4.00.0060.03711.47
5.3.280.0070.04012.71
5.3.270.0070.04112.72
5.3.260.0140.05212.72
5.3.250.0110.04412.72
5.3.240.0080.04112.72
5.3.230.0040.04212.71
5.3.220.0110.03412.68
5.3.210.0070.04112.68
5.3.200.0070.03912.68
5.3.190.0110.03512.68
5.3.180.0150.06412.67
5.3.170.0140.04712.67
5.3.160.0150.07012.68
5.3.150.0150.09712.68
5.3.140.0140.06412.66
5.3.130.0080.04512.66
5.3.120.0040.04312.66
5.3.110.0070.04512.66
5.3.100.0140.04512.12
5.3.90.0140.05112.08
5.3.80.0050.04012.07
5.3.70.0060.05112.07
5.3.60.0090.05812.06
5.3.50.0160.06312.00
5.3.40.0130.04712.00
5.3.30.0100.04711.95
5.3.20.0060.06111.75
5.3.10.0140.11711.71
5.3.00.0140.05411.70
5.2.170.0080.0399.20
5.2.160.0200.0619.19
5.2.150.0160.0339.20
5.2.140.0090.0329.19
5.2.130.0070.0329.15
5.2.120.0060.0339.15
5.2.110.0060.0349.15
5.2.100.0220.0669.16
5.2.90.0060.0459.14
5.2.80.0150.0569.14
5.2.70.0080.0409.14
5.2.60.0340.1029.10
5.2.50.0180.0889.07
5.2.40.0090.0389.05
5.2.30.0100.0459.02
5.2.20.0060.0319.01
5.2.10.0240.0718.92
5.2.00.0080.0358.79
5.1.60.0230.0638.07
5.1.50.0060.0518.07
5.1.40.0060.0348.05
5.1.30.0070.0388.40
5.1.20.0080.0368.43
5.1.10.0080.0338.16
5.1.00.0060.0248.15
5.0.50.0050.0206.64
5.0.40.0070.0216.50
5.0.30.0060.0366.30
5.0.20.0060.0226.28
5.0.10.0060.0216.26
5.0.00.0020.0326.25
4.4.90.0040.0154.78
4.4.80.0020.0184.75
4.4.70.0040.0164.75
4.4.60.0060.0184.76
4.4.50.0040.0164.77
4.4.40.0040.0254.71
4.4.30.0080.0114.75
4.4.20.0060.0174.85
4.4.10.0040.0154.85
4.4.00.0030.0324.76
4.3.110.0020.0234.67
4.3.100.0040.0164.66
4.3.90.0040.0164.63
4.3.80.0030.0324.59
4.3.70.0040.0204.63
4.3.60.0030.0164.63
4.3.50.0060.0134.63
4.3.40.0040.0244.54
4.3.30.0020.0183.30
4.3.20.0030.0163.29
4.3.10.0030.0163.25
4.3.00.0300.01013.47

preferences:
142.22 ms | 1394 KiB | 7 Q