3v4l.org

run code in 300+ PHP versions simultaneously
<?php $payload = ['A', 'B', 'C', 'D']; $total = (1 << count($payload)) - 1; $result = []; for($i = 1; $i <= $total; ++$i){ if(($i & ($i - 1)) == 0) continue; // avoiding single items since you don't wish to have them $curr = []; for($j = 0; $j < count($payload); ++$j){ if(($i & (1 << $j)) > 0){ $curr[] = $payload[ $j ]; } } $result[] = $curr; } usort($result, function($a, $b){ return strcmp( implode("|", $a), implode("|", $b) ); }); 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.4.130.0090.01217.88
8.4.120.0100.01022.23
8.4.110.0130.00618.96
8.4.100.0080.01117.94
8.4.90.0110.01017.40
8.4.80.0150.00617.60
8.4.70.0090.01118.05
8.4.60.0090.00318.62
8.4.50.0120.00717.88
8.4.40.0130.00717.93
8.4.30.0100.01022.22
8.4.20.0090.00018.03
8.4.10.0100.01024.01
8.3.260.0120.00816.75
8.3.250.0100.00818.93
8.3.240.0120.00816.55
8.3.230.0110.00816.86
8.3.220.0110.00816.69
8.3.210.0070.00816.46
8.3.200.0060.00316.79
8.3.190.0100.00816.49
8.3.180.0110.00916.53
8.3.170.0130.00617.01
8.3.160.0060.01318.30
8.3.150.0110.00718.85
8.3.140.0000.00818.82
8.3.130.0040.00418.26
8.3.120.0090.00920.91
8.3.110.0060.00320.94
8.3.100.0080.00024.06
8.3.90.0100.00026.77
8.3.80.0060.00317.97
8.3.70.0100.00718.30
8.3.60.0130.00621.34
8.3.50.0100.01221.24
8.3.40.0190.01323.02
8.3.30.0200.00723.08
8.3.20.0150.00724.31
8.3.10.0130.00624.43
8.3.00.0160.00524.81
8.2.290.0110.00820.40
8.2.280.0060.00216.59
8.2.270.0120.00617.46
8.2.260.0070.01020.65
8.2.250.0090.00916.68
8.2.240.0030.00617.41
8.2.230.0080.00022.58
8.2.220.0040.00437.54
8.2.210.0070.01026.77
8.2.200.0060.00316.88
8.2.190.0090.00616.88
8.2.180.0290.00525.92
8.2.170.0240.01022.43
8.2.160.0190.00623.95
8.2.150.0140.00924.68
8.2.140.0130.00624.43
8.2.130.0100.00624.81
8.2.120.0100.00623.82
8.2.110.0120.00523.08
8.2.100.0150.00422.73
8.2.90.0130.00622.88
8.2.80.0110.00723.01
8.2.70.0170.00322.67
8.2.60.0100.00522.64
8.2.50.0100.00822.71
8.2.40.0120.00622.71
8.2.30.0100.00722.71
8.2.20.0130.00422.70
8.2.10.0110.00722.70
8.2.00.0140.00422.67
8.1.330.0140.00421.87
8.1.320.0040.00416.20
8.1.310.0040.01118.11
8.1.300.0030.00917.56
8.1.290.0030.00630.84
8.1.280.0170.01225.92
8.1.270.0120.00423.47
8.1.260.0110.00624.86
8.1.250.0120.00825.29
8.1.240.0130.00423.78
8.1.230.0160.00523.50
8.1.220.0120.00822.74
8.1.210.0160.00422.96
8.1.200.0110.00622.64
8.1.190.0090.00622.60
8.1.180.0100.00622.61
8.1.170.0100.00622.55
8.1.160.0110.00522.60
8.1.150.0110.00622.60
8.1.140.0090.00722.60
8.1.130.0110.00522.60
8.1.120.0080.00822.63
8.1.110.0090.00622.58
8.1.100.0110.00522.60
8.1.90.0130.00422.61
8.1.80.0150.00522.64
8.1.70.0110.00522.60
8.1.60.0110.00622.64
8.1.50.0160.00022.58
8.1.40.0110.00522.67
8.1.30.0100.00722.63
8.1.20.0140.00422.63
8.1.10.0160.00422.64
8.1.00.0130.00322.63
8.0.300.0070.00823.33
8.0.290.0150.00822.55
8.0.280.0180.00422.55
8.0.270.0160.00422.55
8.0.260.0150.00522.55
8.0.250.0140.00522.55
8.0.240.0170.00622.55
8.0.230.0130.00622.55
8.0.220.0140.00522.55
8.0.210.0150.00722.55
8.0.200.0160.00522.55
8.0.190.0170.00522.55
8.0.180.0150.00422.55
8.0.170.0190.00622.55
8.0.160.0150.00522.55
8.0.150.0230.00322.55
8.0.140.0170.00622.55
8.0.130.0170.00522.55
8.0.120.0190.00222.55
8.0.110.0150.00522.55
8.0.100.0130.00622.55
8.0.90.0170.00622.55
8.0.80.0150.00422.55
8.0.70.0080.01022.55
8.0.60.0200.00422.55
8.0.50.0190.00522.55
8.0.30.0090.00622.55
8.0.20.0120.00522.55
8.0.10.0160.00522.55

preferences:
68.55 ms | 403 KiB | 5 Q