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; } print_r($comb); //foreahc

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.40.0090.00618.80
8.3.30.0110.00319.25
8.3.20.0080.00020.35
8.3.10.0040.00421.77
8.3.00.0080.00019.79
8.2.170.0100.01022.96
8.2.160.0120.00320.27
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00420.98
8.2.110.0060.00320.87
8.2.100.0080.00417.91
8.2.90.0000.00817.97
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0030.00818.03
8.2.50.0000.00818.07
8.2.40.0090.00019.82
8.2.30.0030.00918.23
8.2.20.0000.00717.66
8.2.10.0040.00418.01
8.2.00.0040.00417.74
8.1.270.0050.00323.91
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00322.66
8.1.230.0070.00420.89
8.1.220.0050.00317.78
8.1.210.0000.00918.97
8.1.200.0040.00817.35
8.1.190.0040.00417.10
8.1.180.0030.00518.10
8.1.170.0040.00418.71
8.1.160.0040.00421.89
8.1.150.0000.00818.84
8.1.140.0030.00617.36
8.1.130.0040.00417.87
8.1.120.0000.00717.46
8.1.110.0040.00417.46
8.1.100.0030.00517.34
8.1.90.0050.00217.36
8.1.80.0020.00517.47
8.1.70.0010.00117.40
8.1.60.0000.00817.52
8.1.50.0050.00317.45
8.1.40.0000.00717.50
8.1.30.0080.00017.67
8.1.20.0000.00717.60
8.1.10.0020.00517.62
8.1.00.0060.00317.37
8.0.300.0050.00319.90
8.0.290.0040.00416.58
8.0.280.0000.00718.51
8.0.270.0020.00517.29
8.0.260.0030.00317.18
8.0.250.0000.00716.91
8.0.240.0040.00416.89
8.0.230.0000.00716.87
8.0.220.0000.00816.79
8.0.210.0000.00816.86
8.0.200.0030.00316.91
8.0.190.0030.00516.86
8.0.180.0040.00416.80
8.0.170.0040.00416.92
8.0.160.0000.00716.81
8.0.150.0040.00416.82
8.0.140.0000.00916.91
8.0.130.0050.00013.31
8.0.120.0030.00616.76
8.0.110.0060.00316.99
8.0.100.0050.00316.94
8.0.90.0030.00316.80
8.0.80.0030.01216.77
8.0.70.0000.00816.93
8.0.60.0040.00416.96
8.0.50.0040.00416.95
8.0.30.0100.00917.03
8.0.20.0120.00717.40
8.0.10.0070.00016.95
8.0.00.0060.01216.73
7.4.330.0050.00015.09
7.4.320.0030.00316.59
7.4.300.0060.00016.62
7.4.290.0070.00016.45
7.4.280.0000.00816.53
7.4.270.0070.00016.44
7.4.260.0000.00716.52
7.4.250.0040.00416.58
7.4.240.0020.00516.50
7.4.230.0000.00716.64
7.4.220.0030.01216.56
7.4.210.0080.00616.54
7.4.200.0030.00316.63
7.4.160.0060.01516.32
7.4.150.0150.00317.40
7.4.140.0100.00717.86
7.4.130.0140.00716.67
7.4.120.0080.01216.52
7.4.110.0170.00716.45
7.4.100.0090.00916.54
7.4.90.0070.01716.58
7.4.80.0210.00719.39
7.4.70.0060.01016.38
7.4.60.0190.00016.45
7.4.50.0000.00716.66
7.4.40.0000.01616.47
7.4.30.0100.00616.47
7.4.00.0040.01115.05
7.3.330.0040.00413.13
7.3.320.0050.00013.18
7.3.310.0000.00716.38
7.3.300.0000.00716.26
7.3.290.0000.00716.20
7.3.280.0100.00816.28
7.3.270.0080.00817.40
7.3.260.0070.01116.32
7.3.250.0120.01016.49
7.3.240.0140.00616.29
7.3.230.0160.00416.39
7.3.210.0100.00616.30
7.3.200.0030.01319.39
7.3.190.0030.01316.35
7.3.180.0140.00616.45
7.3.170.0030.01216.36
7.3.160.0160.00016.29
7.3.120.0100.00314.89
7.2.330.0070.01016.60
7.2.320.0070.01416.82
7.2.310.0100.01316.81
7.2.300.0070.01116.75
7.2.290.0110.00516.91
7.2.60.0190.00416.88
7.2.00.0060.00619.26
7.1.200.0000.01115.66
7.1.100.0070.01018.22
7.1.70.0040.00716.94
7.1.60.0070.01719.25
7.1.50.0100.01416.77
7.1.00.0000.08022.31
7.0.200.0250.00716.30
7.0.140.0070.06321.99
7.0.110.0070.07720.09
7.0.100.0070.08319.96
7.0.90.0000.09020.05
7.0.80.0100.08019.83
7.0.70.0200.07319.92
7.0.60.0030.05720.09
7.0.50.0170.05319.95
7.0.40.0100.08719.85
7.0.30.0030.07719.88
7.0.20.0100.08019.85
7.0.10.0070.08319.69
7.0.00.0030.05719.80
5.6.280.0070.06721.13
5.6.260.0100.04320.70
5.6.250.0100.07020.68
5.6.240.0130.07320.61
5.6.230.0200.04320.57
5.6.220.0000.06020.67
5.6.210.0070.08320.73
5.6.200.0030.08720.69
5.6.190.0070.07720.56
5.6.180.0100.05720.70
5.6.170.0200.07020.60
5.6.160.0070.08020.67
5.6.150.0100.07720.64
5.6.140.0070.08020.69
5.6.130.0300.04320.64
5.6.120.0170.07720.61
5.6.110.0130.08020.58
5.6.100.0130.07020.54
5.6.90.0170.07020.54
5.6.80.0130.04019.93
5.6.70.0100.05020.22
5.6.60.0130.04019.96
5.6.50.0100.05319.94
5.6.40.0100.07019.97
5.6.30.0070.08720.21
5.6.20.0200.06020.06
5.6.10.0130.04019.98
5.6.00.0070.07719.92
5.5.380.0000.07717.70
5.5.370.0100.07017.59
5.5.360.0070.07717.55
5.5.350.0070.08317.61
5.5.340.0100.06018.25
5.5.330.0100.08018.12
5.5.320.0070.07018.10
5.5.310.0100.07318.09
5.5.300.0130.08017.95
5.5.290.0100.08317.93
5.5.280.0070.08318.08
5.5.270.0070.08317.90
5.5.260.0070.08017.82
5.5.250.0030.06717.91
5.5.240.0130.07017.49
5.5.230.0100.08017.29
5.5.220.0000.05317.42
5.5.210.0000.09017.63
5.5.200.0100.07017.47
5.5.190.0000.08317.40
5.5.180.0100.06317.28
5.5.160.0070.07717.47
5.5.150.0030.08017.42
5.5.140.0070.03717.47
5.5.130.0070.07717.48
5.5.120.0130.07317.32
5.5.110.0030.08017.44
5.5.100.0030.08317.38
5.5.90.0130.06317.08
5.5.80.0130.07017.32
5.5.70.0100.06717.29
5.5.60.0200.05717.46
5.5.50.0100.06317.17
5.5.40.0070.07317.34
5.5.30.0070.07717.29
5.5.20.0070.07317.31
5.5.10.0030.07717.31
5.5.00.0030.07717.16
5.4.450.0070.08319.36
5.4.440.0130.07319.46
5.4.430.0230.06019.31
5.4.420.0100.06719.35
5.4.410.0100.08019.53
5.4.400.0030.07719.34
5.4.390.0130.07019.01
5.4.380.0030.06719.16
5.4.370.0000.07719.14
5.4.360.0200.03019.01
5.4.350.0030.08019.34
5.4.340.0100.07019.33
5.4.320.0170.06719.33
5.4.310.0070.07319.16
5.4.300.0070.03719.00
5.4.290.0130.07019.18
5.4.280.0070.06018.97
5.4.270.0070.07018.95
5.4.260.0130.07319.01
5.4.250.0130.07019.00
5.4.240.0200.06319.00
5.4.230.0070.07319.33
5.4.220.0000.06719.17
5.4.210.0130.06719.21
5.4.200.0130.07019.17
5.4.190.0100.06718.99
5.4.180.0030.07719.07
5.4.170.0030.07318.94
5.4.160.0070.08019.15
5.4.150.0030.04719.00
5.4.140.0070.04316.59
5.4.130.0170.02316.38
5.4.120.0000.04016.46
5.4.110.0070.03316.59
5.4.100.0030.03716.46
5.4.90.0030.03716.55
5.4.80.0100.03016.47
5.4.70.0000.04016.55
5.4.60.0070.03716.47
5.4.50.0030.03316.40
5.4.40.0070.07316.53
5.4.30.0000.07716.56
5.4.20.0030.07716.28
5.4.10.0070.07316.23
5.4.00.0000.07315.77
5.3.290.0030.08014.81
5.3.280.0030.08014.56
5.3.270.0070.07314.75
5.3.260.0070.07014.61
5.3.250.0130.06014.82
5.3.240.0100.05714.59
5.3.230.0070.03714.57
5.3.220.0070.03714.52
5.3.210.0030.04314.64
5.3.200.0030.03714.64
5.3.190.0000.04014.61
5.3.180.0000.04014.79
5.3.170.0030.03314.55
5.3.160.0030.03714.64
5.3.150.0070.04314.56
5.3.140.0070.04014.69
5.3.130.0030.07714.39
5.3.120.0070.07714.68
5.3.110.0070.05014.54
5.3.100.0100.07014.04
5.3.90.0070.07714.14
5.3.80.0030.04014.15
5.3.70.0030.05314.10
5.3.60.0030.03314.00
5.3.50.0070.05713.92
5.3.40.0030.04713.93
5.3.30.0000.04013.92
5.3.20.0070.05313.69
5.3.10.0070.03313.64
5.3.00.0030.04013.76
5.2.170.0000.03711.15
5.2.160.0070.04311.20
5.2.150.0070.03311.37
5.2.140.0000.03011.09
5.2.130.0000.04011.11
5.2.120.0030.04011.32
5.2.110.0030.04710.95
5.2.100.0000.03011.17
5.2.90.0030.04011.11
5.2.80.0030.03710.95
5.2.70.0100.03011.22
5.2.60.0030.02711.08
5.2.50.0030.02710.98
5.2.40.0030.05311.05
5.2.30.0030.03010.96
5.2.20.0000.03011.04
5.2.10.0000.02710.87
5.2.00.0000.02710.71
5.1.60.0000.0379.89
5.1.50.0030.02010.06
5.1.40.0070.02010.03
5.1.30.0030.02310.23
5.1.20.0070.02010.23
5.1.10.0000.02710.21
5.1.00.0000.0339.96
5.0.50.0000.0379.70
5.0.40.0030.0439.70
5.0.30.0070.0279.70
5.0.20.0070.0139.70
5.0.10.0030.0179.70
5.0.00.0000.0309.70
4.4.90.0000.0179.70
4.4.80.0030.0139.70
4.4.70.0000.0139.70
4.4.60.0000.0139.70
4.4.50.0000.0279.70
4.4.40.0000.0239.70
4.4.30.0000.0179.70
4.4.20.0000.0239.70
4.4.10.0000.0209.70
4.4.00.0030.0209.70
4.3.110.0070.0209.70
4.3.100.0070.0279.70
4.3.90.0000.0139.70
4.3.80.0000.0309.70
4.3.70.0000.0379.70
4.3.60.0000.0139.70
4.3.50.0030.0179.70
4.3.40.0000.0239.70
4.3.30.0000.0139.70
4.3.20.0000.0179.70
4.3.10.0000.0179.70
4.3.00.0000.0139.70

preferences:
47.19 ms | 400 KiB | 5 Q