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; } } print_r($result);

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.0150.00018.18
8.3.50.0090.00722.11
8.3.40.0070.00718.72
8.3.30.0040.01119.04
8.3.20.0000.00820.30
8.3.10.0040.00421.78
8.3.00.0000.00918.00
8.2.180.0090.00916.50
8.2.170.0090.00622.96
8.2.160.0080.00620.57
8.2.150.0000.00924.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0030.00520.96
8.2.110.0040.00722.13
8.2.100.0060.00617.84
8.2.90.0040.00419.21
8.2.80.0040.00417.97
8.2.70.0000.00817.38
8.2.60.0090.00018.05
8.2.50.0040.00418.07
8.2.40.0040.00420.07
8.2.30.0080.00418.39
8.2.20.0030.00517.80
8.2.10.0050.00218.13
8.2.00.0030.00517.83
8.1.280.0070.00725.92
8.1.270.0060.00323.99
8.1.260.0080.00026.35
8.1.250.0020.00528.09
8.1.240.0100.00019.27
8.1.230.0070.00419.16
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0040.00817.35
8.1.190.0040.00417.10
8.1.180.0030.00518.10
8.1.170.0000.00918.52
8.1.160.0000.00722.02
8.1.150.0050.00318.95
8.1.140.0000.00717.38
8.1.130.0000.00717.82
8.1.120.0040.00417.51
8.1.110.0000.00817.48
8.1.100.0000.00717.49
8.1.90.0000.00817.54
8.1.80.0000.00717.45
8.1.70.0050.00317.39
8.1.60.0000.00817.62
8.1.50.0040.00417.58
8.1.40.0060.00317.43
8.1.30.0040.00417.68
8.1.20.0050.00217.56
8.1.10.0040.00417.46
8.1.00.0000.00717.52
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0030.00318.50
8.0.270.0000.00817.27
8.0.260.0080.00017.18
8.0.250.0000.00816.84
8.0.240.0080.00016.98
8.0.230.0030.00316.90
8.0.220.0000.00716.86
8.0.210.0000.00716.79
8.0.200.0000.00616.94
8.0.190.0000.00717.01
8.0.180.0040.00416.84
8.0.170.0040.00416.97
8.0.160.0000.00816.96
8.0.150.0000.00716.81
8.0.140.0070.00316.88
8.0.130.0000.00613.37
8.0.120.0030.00516.88
8.0.110.0000.00716.96
8.0.100.0040.00416.94
8.0.90.0040.00416.80
8.0.80.0060.00916.79
8.0.70.0000.00716.77
8.0.60.0000.00716.96
8.0.50.0000.00816.73
8.0.30.0160.00816.95
8.0.20.0070.01117.40
8.0.10.0000.00716.97
8.0.00.0080.01116.88
7.4.330.0020.00215.10
7.4.320.0000.00716.57
7.4.300.0000.00616.61
7.4.290.0040.00416.62
7.4.280.0000.00716.51
7.4.270.0000.00716.59
7.4.260.0000.00716.60
7.4.250.0000.00816.52
7.4.240.0030.00516.57
7.4.230.0030.00316.33
7.4.220.0150.00016.48
7.4.210.0070.00716.64
7.4.200.0060.00016.41
7.4.160.0120.00916.41
7.4.150.0090.00917.40
7.4.140.0090.00817.86
7.4.130.0080.00916.57
7.4.120.0100.00716.58
7.4.110.0140.00416.59
7.4.100.0090.00816.39
7.4.90.0170.00016.52
7.4.80.0130.01019.39
7.4.70.0080.00816.48
7.4.60.0030.01416.56
7.4.50.0000.00816.39
7.4.40.0060.00916.64
7.4.30.0030.01316.33
7.4.00.0060.01114.76
7.3.330.0000.00713.10
7.3.320.0060.00013.00
7.3.310.0030.00316.29
7.3.300.0030.00316.13
7.3.290.0050.00916.30
7.3.280.0090.00916.25
7.3.270.0100.00717.40
7.3.260.0120.00616.24
7.3.250.0080.01116.33
7.3.240.0130.00316.33
7.3.230.0030.01716.46
7.3.210.0070.01116.60
7.3.200.0030.01719.39
7.3.190.0120.00616.61
7.3.180.0080.00816.41
7.3.170.0060.00916.48
7.3.160.0130.00316.34
7.3.120.0050.01314.60
7.3.110.0140.00414.73
7.3.100.0030.01214.99
7.3.90.0060.00914.98
7.3.80.0060.01014.84
7.3.70.0070.00714.62
7.3.60.0050.00914.46
7.3.50.0110.00214.79
7.3.40.0090.00914.58
7.3.30.0050.00814.76
7.3.20.0030.00916.63
7.3.10.0080.00716.64
7.3.00.0060.00816.60
7.2.330.0100.00616.86
7.2.320.0120.00616.79
7.2.310.0120.00616.92
7.2.300.0060.01216.76
7.2.290.0040.01216.52
7.2.250.0060.01215.00
7.2.240.0100.01015.27
7.2.230.0060.01214.73
7.2.220.0060.00615.07
7.2.210.0030.01215.08
7.2.200.0000.01515.11
7.2.190.0060.01115.07
7.2.180.0070.00815.21
7.2.170.0030.01015.05
7.2.160.0160.00014.83
7.2.150.0150.00917.14
7.2.140.0060.00617.00
7.2.130.0100.00416.77
7.2.120.0060.00716.81
7.2.110.0080.00916.69
7.2.100.0150.00516.79
7.2.90.0080.01016.92
7.2.80.0090.00716.92
7.2.70.0120.00716.80
7.2.60.0170.00416.78
7.2.50.0080.00916.84
7.2.40.0080.00716.80
7.2.30.0100.00616.89
7.2.20.0060.01216.89
7.2.10.0090.00616.90
7.2.00.0040.00917.67
7.1.330.0080.00615.83
7.1.320.0060.00316.09
7.1.310.0100.00315.88
7.1.300.0050.00715.78
7.1.290.0150.00315.89
7.1.280.0090.00915.93
7.1.270.0070.00715.85
7.1.260.0100.00615.95
7.1.250.0060.00615.55
7.1.240.0090.00915.89
7.1.230.0140.00915.48
7.1.220.0210.00315.61
7.1.210.0230.00415.81
7.1.200.0100.00615.76
7.1.190.0090.00915.98
7.1.180.0110.01115.75
7.1.170.0170.00915.74
7.1.160.0130.00815.92
7.1.150.0080.00815.51
7.1.140.0040.01515.95
7.1.130.0120.00615.98
7.1.120.0040.01215.71
7.1.110.0080.01515.50
7.1.100.0100.00416.76
7.1.90.0150.00415.88
7.1.80.0130.00715.79
7.1.70.0090.00816.44
7.1.60.0100.01117.54
7.1.50.0090.01116.47
7.1.40.0180.00615.91
7.1.30.0150.00315.61
7.1.20.0150.00515.92
7.1.10.0130.00615.70
7.1.00.0100.04019.15
7.0.330.0140.00915.25
7.0.320.0120.01015.50
7.0.310.0140.01415.49
7.0.300.0160.00715.42
7.0.290.0140.01015.42
7.0.280.0130.00515.20
7.0.270.0130.00815.29
7.0.260.0100.00615.30
7.0.250.0090.00915.27
7.0.240.0080.01615.26
7.0.230.0100.01015.58
7.0.220.0060.01115.32
7.0.210.0130.00915.28
7.0.200.0180.00615.91
7.0.190.0140.01115.53
7.0.180.0140.00615.37
7.0.170.0080.01215.23
7.0.160.0080.01415.32
7.0.150.0160.00215.38
7.0.140.0150.03018.64
7.0.130.0190.00915.44
7.0.120.0120.00715.59
7.0.110.0140.00915.34
7.0.100.0140.00615.42
7.0.90.0190.00715.28
7.0.80.0170.00315.32
7.0.70.0110.05117.77
7.0.60.0120.04317.63
7.0.50.0070.05117.78
7.0.40.0090.04117.82
7.0.30.0060.02817.71
7.0.20.0080.04917.77
7.0.10.0100.03317.74
7.0.00.0070.03717.80
5.6.400.0050.01514.15
5.6.390.0110.00714.12
5.6.380.0180.01214.62
5.6.370.0200.01214.57
5.6.360.0160.01014.55
5.6.350.0100.00914.41
5.6.340.0220.00014.68
5.6.330.0180.00314.65
5.6.320.0120.00814.21
5.6.310.0150.00614.71
5.6.300.0090.01214.45
5.6.290.0150.01214.52
5.6.280.0140.03517.60
5.6.270.0200.00014.61
5.6.260.0300.00014.68
5.6.250.0130.00714.35
5.6.240.0110.01114.50
5.6.230.0270.00714.43
5.6.220.0130.04617.47
5.6.210.0090.03317.54
5.6.200.0140.03017.77
5.6.190.0140.04917.75
5.6.180.0130.04517.72
5.6.170.0090.03217.66
5.6.160.0100.04517.69
5.6.150.0140.03917.66
5.6.140.0130.02717.76
5.6.130.0150.04017.81
5.6.120.0120.04317.64
5.6.110.0130.04017.66
5.6.100.0150.03717.62
5.6.90.0110.03517.75
5.6.80.0110.04017.37
5.6.70.0070.03617.35
5.6.60.0120.04217.34
5.6.50.0140.03717.27
5.6.40.0070.02917.38
5.6.30.0130.02317.37
5.6.20.0120.04717.22
5.6.10.0140.02417.26
5.6.00.0150.02917.30
5.5.380.0260.00414.52
5.5.370.0130.01914.51
5.5.360.0130.04717.39
5.5.350.0060.04017.44
5.5.340.0110.04117.73
5.5.330.0090.03917.70
5.5.320.0100.04817.58
5.5.310.0180.04217.56
5.5.300.0100.04417.49
5.5.290.0180.03617.65
5.5.280.0140.04117.55
5.5.270.0180.02917.58
5.5.260.0120.04917.64
5.5.250.0070.03617.47
5.5.240.0060.04417.29
5.5.230.0090.02317.20
5.5.220.0090.03317.25
5.5.210.0180.03417.40
5.5.200.0190.04117.33
5.5.190.0150.04017.13
5.5.180.0110.04217.27
5.5.170.0170.01014.14
5.5.160.0160.03917.34
5.5.150.0140.03917.23
5.5.140.0080.04017.21
5.5.130.0120.03917.17
5.5.120.0100.04417.24
5.5.110.0130.04117.26
5.5.100.0160.04817.13
5.5.90.0080.03717.35
5.5.80.0100.04517.20
5.5.70.0070.04217.14
5.5.60.0190.03617.34
5.5.50.0070.04717.29
5.5.40.0160.04117.26
5.5.30.0100.02717.29
5.5.20.0120.04417.13
5.5.10.0110.04517.28
5.5.00.0100.02317.10
5.4.450.0080.05115.94
5.4.440.0170.02815.80
5.4.430.0090.04215.84
5.4.420.0100.04215.92
5.4.410.0110.03615.72
5.4.400.0110.03515.73
5.4.390.0040.03615.78
5.4.380.0070.04115.80
5.4.370.0110.03715.66
5.4.360.0110.04415.72
5.4.350.0080.04315.77
5.4.340.0100.03415.72
5.4.330.0050.00912.41
5.4.320.0130.03515.72
5.4.310.0060.04315.72
5.4.300.0070.04315.81
5.4.290.0050.04715.65
5.4.280.0070.04315.78
5.4.270.0120.04215.76
5.4.260.0130.03815.68
5.4.250.0060.03715.75
5.4.240.0020.05015.78
5.4.230.0110.03715.81
5.4.220.0070.04315.76
5.4.210.0090.04115.63
5.4.200.0030.04815.65
5.4.190.0080.04315.72
5.4.180.0110.04015.71
5.4.170.0080.03915.65
5.4.160.0130.04015.77
5.4.150.0120.03915.64
5.4.140.0080.04214.42
5.4.130.0130.02614.41
5.4.120.0070.04214.43
5.4.110.0060.04514.38
5.4.100.0150.03714.44
5.4.90.0070.04414.42
5.4.80.0090.02714.44
5.4.70.0050.04114.45
5.4.60.0150.03414.43
5.4.50.0190.03014.43
5.4.40.0070.02414.43
5.4.30.0180.03214.35
5.4.20.0030.04514.38
5.4.10.0120.03914.37
5.4.00.0130.04014.14
5.3.290.0100.04314.10
5.3.280.0100.02414.10
5.3.270.0090.04214.10
5.3.260.0100.03114.10
5.3.250.0090.02414.10
5.3.240.0120.04014.10
5.3.230.0060.04114.10
5.3.220.0120.03814.10
5.3.210.0130.03314.10
5.3.200.0140.04014.10
5.3.190.0100.04114.10
5.3.180.0110.03814.10
5.3.170.0090.03714.10
5.3.160.0110.04214.10
5.3.150.0110.03814.10
5.3.140.0080.03814.10
5.3.130.0120.03814.10
5.3.120.0070.04414.10
5.3.110.0070.03714.10
5.3.100.0180.03714.10
5.3.90.0100.03814.10
5.3.80.0060.04214.10
5.3.70.0110.03914.10
5.3.60.0070.03414.10
5.3.50.0050.04214.10
5.3.40.0140.03814.10
5.3.30.0060.04014.10
5.3.20.0080.04014.10
5.3.10.0140.03014.10
5.3.00.0040.02414.10

preferences:
37.43 ms | 401 KiB | 5 Q