3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array('A', 'B'); $array2 = array('1', '2', '3'); $num = count($array2); $comb = array(); //The total number of possible combinations $total = pow(2, $num); //Loop through each possible combination for ($i = 0; $i < $total; $i++) { $flag = ''; //For each combination check if each bit is set for ($j = 0; $j < $num; $j++) { //Is bit $j set in $i? if (pow(2, $j) & $i) $flag = $flag.''.$array2[$j]; } if(!empty($flag)) $comb[] = $flag; } $result = array(); foreach($array1 as $val) { foreach($comb as $co) { $result[] = $val."".$co; } }

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.0070.00718.43
8.3.50.0080.01022.02
8.3.40.0140.00718.84
8.3.30.0200.00019.09
8.3.20.0050.00220.21
8.3.10.0070.00021.95
8.3.00.0000.00819.68
8.2.180.0090.00916.75
8.2.170.0080.00622.96
8.2.160.0140.00020.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0030.00520.97
8.2.110.0000.00822.08
8.2.100.0080.00318.22
8.2.90.0040.00419.36
8.2.80.0000.00817.97
8.2.70.0000.00917.73
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0060.00320.01
8.2.30.0040.00418.36
8.2.20.0030.00617.82
8.2.10.0060.00318.04
8.2.00.0040.00417.61
8.1.280.0110.00325.92
8.1.270.0080.00023.96
8.1.260.0030.00626.35
8.1.250.0110.00328.09
8.1.240.0030.00622.19
8.1.230.0070.00418.89
8.1.220.0000.00817.77
8.1.210.0030.00618.77
8.1.200.0030.00617.25
8.1.190.0060.00617.23
8.1.180.0060.00318.10
8.1.170.0000.00818.39
8.1.160.0000.00721.93
8.1.150.0050.00218.84
8.1.140.0000.00717.48
8.1.130.0040.00417.93
8.1.120.0000.00717.49
8.1.110.0080.00017.48
8.1.100.0000.00717.40
8.1.90.0000.00717.36
8.1.80.0070.00017.43
8.1.70.0070.00317.43
8.1.60.0000.00717.56
8.1.50.0040.00417.54
8.1.40.0040.00417.51
8.1.30.0050.00317.64
8.1.20.0000.00817.59
8.1.10.0000.00817.52
8.1.00.0000.00717.52
8.0.300.0080.00018.77
8.0.290.0050.00216.75
8.0.280.0030.00318.33
8.0.270.0020.00517.23
8.0.260.0030.00317.27
8.0.250.0030.00317.01
8.0.240.0030.00616.98
8.0.230.0030.00316.86
8.0.220.0040.00416.95
8.0.210.0040.00416.80
8.0.200.0060.00016.85
8.0.190.0070.00016.94
8.0.180.0000.00716.88
8.0.170.0030.00516.89
8.0.160.0080.00016.84
8.0.150.0030.00616.95
8.0.140.0000.00916.88
8.0.130.0030.00313.32
8.0.120.0080.00016.90
8.0.110.0080.00016.89
8.0.100.0040.00416.94
8.0.90.0000.00816.81
8.0.80.0120.00316.88
8.0.70.0040.00416.84
8.0.60.0040.00416.73
8.0.50.0040.00416.84
8.0.30.0080.01017.09
8.0.20.0110.00817.40
8.0.10.0000.00717.14
8.0.00.0100.01516.83
7.4.330.0050.00015.00
7.4.320.0070.00016.41
7.4.300.0050.00216.50
7.4.290.0080.00016.53
7.4.280.0000.00716.50
7.4.270.0030.00316.51
7.4.260.0030.00316.48
7.4.250.0040.00416.45
7.4.240.0000.00716.65
7.4.230.0030.00316.69
7.4.220.0100.00616.69
7.4.210.0030.01016.55
7.4.200.0030.00316.62
7.4.160.0080.00816.67
7.4.150.0150.00617.40
7.4.140.0170.00317.86
7.4.130.0080.00816.45
7.4.120.0110.00816.53
7.4.110.0030.01316.31
7.4.100.0100.00716.59
7.4.90.0060.01116.46
7.4.80.0110.00719.39
7.4.70.0090.00616.56
7.4.60.0100.00816.43
7.4.50.0030.00316.54
7.4.40.0150.00616.59
7.4.30.0100.00616.63
7.4.00.0120.00614.75
7.3.330.0080.00013.06
7.3.320.0060.00013.15
7.3.310.0040.00416.11
7.3.300.0030.00416.26
7.3.290.0060.01216.38
7.3.280.0100.01016.24
7.3.270.0180.00017.40
7.3.260.0030.01316.30
7.3.250.0110.00816.48
7.3.240.0120.00616.54
7.3.230.0070.01016.39
7.3.210.0140.00616.39
7.3.200.0160.00819.39
7.3.190.0150.00616.43
7.3.180.0070.00716.48
7.3.170.0060.00916.27
7.3.160.0120.00916.32
7.3.120.0060.01214.91
7.2.330.0140.00316.70
7.2.320.0100.00616.81
7.2.310.0070.01116.75
7.2.300.0140.00516.81
7.2.290.0220.01516.59
7.2.110.0030.00616.61
7.2.60.0070.00717.05
7.1.200.0040.01115.75
7.1.70.0070.01017.02
7.1.60.0070.01619.25
7.1.50.0030.02216.98
7.1.00.0030.07722.43
7.0.200.0210.00316.38
7.0.140.0000.07722.09
7.0.60.0200.07019.98
7.0.50.0030.04017.82
7.0.40.0100.06720.21
7.0.30.0270.07320.01
7.0.20.0230.05720.09
7.0.10.0230.05020.09
7.0.00.0070.04720.09
5.6.280.0030.07321.03
5.6.210.0000.07720.64
5.6.200.0070.08318.19
5.6.190.0070.04020.48
5.6.180.0070.06020.25
5.6.170.0270.07020.71
5.6.160.0000.05720.46
5.6.150.0030.08018.13
5.6.140.0000.04018.11
5.6.130.0030.04318.12
5.6.120.0000.05721.00
5.6.110.0130.08021.01
5.6.100.0070.08321.04
5.6.90.0070.08320.98
5.6.80.0100.06020.44
5.5.350.0270.08320.34
5.5.340.0130.07318.01
5.5.330.0030.05320.37
5.5.320.0200.06720.25
5.5.310.0330.07720.32
5.5.300.0070.07017.97
5.5.290.0100.07717.98
5.5.280.0170.04720.81
5.5.270.0130.07320.68
5.5.260.0030.07320.98
5.5.250.0130.05320.59
5.5.240.0100.07320.25
5.4.450.0700.07019.13
5.4.440.0300.06019.24
5.4.430.0870.06019.25
5.4.420.0970.04319.52
5.4.410.0130.05318.69
5.4.400.0430.05718.70
5.4.390.0630.06718.68
5.4.380.0270.05318.50
5.4.370.0100.03718.62
5.4.360.0030.04018.51
5.4.350.0060.04511.98
5.4.340.0100.04411.98
5.4.320.0050.03812.46
5.4.310.0060.03812.46
5.4.300.0050.03912.46
5.4.290.0100.03712.46
5.4.280.0100.03312.36
5.4.270.0060.04112.36
5.4.260.0050.04212.36
5.4.250.0060.03912.36
5.4.240.0050.03812.36
5.4.230.0090.04012.35
5.4.220.0070.03712.35
5.4.210.0050.03512.35
5.4.200.0030.04112.35
5.4.190.0070.03512.35
5.4.180.0090.03212.35
5.4.170.0060.03612.36
5.4.160.0070.03512.35
5.4.150.0080.03312.35
5.4.140.0060.03612.04
5.4.130.0060.03412.02
5.4.120.0060.03411.98
5.4.110.0040.03711.98
5.4.100.0030.03811.97
5.4.90.0080.03511.97
5.4.80.0040.03811.97
5.4.70.0060.03411.96
5.4.60.0070.03311.96
5.4.50.0020.04011.96
5.4.40.0040.03611.96
5.4.30.0050.03611.96
5.4.20.0070.03511.95
5.4.10.0050.04611.96
5.4.00.0080.04811.45
5.3.290.0070.04212.80
5.3.280.0080.04012.71
5.3.270.0060.04212.72
5.3.260.0080.04612.72
5.3.250.0090.04912.72
5.3.240.0080.04412.72
5.3.230.0040.04412.71
5.3.220.0110.03612.68
5.3.210.0080.04012.68
5.3.200.0080.03512.68
5.3.190.0040.04412.68
5.3.180.0060.03712.67
5.3.170.0090.04812.67
5.3.160.0090.05112.67
5.3.150.0090.04012.67
5.3.140.0080.04912.66
5.3.130.0080.04412.66
5.3.120.0120.04912.66
5.3.110.0050.05512.66
5.3.100.0120.04912.12
5.3.90.0080.04212.09
5.3.80.0060.04412.07
5.3.70.0050.03812.07
5.3.60.0080.03612.07
5.3.50.0080.03712.00
5.3.40.0070.03712.01
5.3.30.0110.04311.95
5.3.20.0070.04511.73
5.3.10.0060.04311.70
5.3.00.0060.04511.69
5.2.170.0040.0319.19
5.2.160.0040.0319.19
5.2.150.0030.0329.19
5.2.140.0030.0329.19
5.2.130.0070.0289.15
5.2.120.0020.0319.15
5.2.110.0060.0289.16
5.2.100.0030.0319.15
5.2.90.0060.0349.14
5.2.80.0050.0409.15
5.2.70.0070.0369.15
5.2.60.0070.0319.10
5.2.50.0050.0299.07
5.2.40.0040.0299.04
5.2.30.0050.0299.02
5.2.20.0060.0309.01
5.2.10.0040.0298.93
5.2.00.0060.0288.79
5.1.60.0050.0308.08
5.1.50.0040.0258.07
5.1.40.0040.0258.05
5.1.30.0040.0308.41
5.1.20.0040.0278.43
5.1.10.0070.0248.15
5.1.00.0050.0258.15
5.0.50.0040.0206.63
5.0.40.0020.0206.49
5.0.30.0070.0286.30
5.0.20.0060.0216.27
5.0.10.0030.0206.26
5.0.00.0040.0306.25
4.4.90.0040.0144.78
4.4.80.0020.0164.75
4.4.70.0060.0124.75
4.4.60.0010.0194.76
4.4.50.0020.0164.77
4.4.40.0040.0254.71
4.4.30.0030.0154.76
4.4.20.0030.0154.84
4.4.10.0000.0184.85
4.4.00.0020.0264.75
4.3.110.0010.0184.67
4.3.100.0030.0154.67
4.3.90.0000.0184.63
4.3.80.0030.0254.59
4.3.70.0030.0144.63
4.3.60.0020.0154.63
4.3.50.0040.0154.62
4.3.40.0020.0254.54
4.3.30.0030.0153.34
4.3.20.0010.0203.31
4.3.10.0030.0193.27
4.3.00.0070.0206.69

preferences:
50.58 ms | 401 KiB | 5 Q