3v4l.org

run code in 300+ PHP versions simultaneously
<?php function powerSet(Iterator $iterator){ if(!$iterator->valid()){ return yield new EmptyIterator(); } $one = $iterator->current(); $rest = new NoRewindIterator($iterator); $rest->next(); foreach(powerSet($rest) as $set){ $set = iterator_to_array($set); yield new ArrayIterator($set); // why does this work yield (function($set, $one){ yield from array_merge($set, [$one]); })($set, $one); // but this doesn't? // yield (function($set, $one){ // yield from $set; // yield $one; // })($set, $one); } } function baz(){ yield 1; yield 2; yield 3; yield 4; } $sets = powerSet(baz()); foreach($sets as $i => $set){ echo $i+1 . " {"; $arr = iterator_to_array($set); echo implode(", ", $arr); echo "}\n"; }

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.01418.31
8.3.50.0160.00321.95
8.3.40.0070.00718.85
8.3.30.0090.00918.60
8.3.20.0000.00819.20
8.3.10.0000.00821.95
8.3.00.0080.00020.77
8.2.180.0080.00818.17
8.2.170.0100.01022.96
8.2.160.0070.00720.38
8.2.150.0080.00024.18
8.2.140.0040.01124.66
8.2.130.0050.00319.22
8.2.120.0000.00826.35
8.2.110.0070.00419.21
8.2.100.0060.00619.66
8.2.90.0040.00419.35
8.2.80.0030.00517.97
8.2.70.0060.00317.50
8.2.60.0020.00717.91
8.2.50.0020.00518.10
8.2.40.0040.00420.57
8.2.30.0060.00319.18
8.2.20.0040.00417.59
8.2.10.0050.00218.10
8.2.00.0080.00018.15
8.1.280.0130.00825.92
8.1.270.0080.00023.99
8.1.260.0080.00028.09
8.1.250.0080.00028.09
8.1.240.0140.00722.20
8.1.230.0080.00419.55
8.1.220.0000.00817.78
8.1.210.0030.00618.77
8.1.200.0000.00917.48
8.1.190.0000.00816.99
8.1.180.0050.00318.10
8.1.170.0000.00818.65
8.1.160.0080.00019.09
8.1.150.0040.00418.89
8.1.140.0020.00519.51
8.1.130.0000.00817.66
8.1.120.0050.00217.46
8.1.110.0030.00617.45
8.1.100.0000.00717.40
8.1.90.0040.00417.47
8.1.80.0040.00417.53
8.1.70.0030.00317.51
8.1.60.0000.00817.63
8.1.50.0040.00417.57
8.1.40.0050.00317.61
8.1.30.0040.00417.68
8.1.20.0000.00817.58
8.1.10.0080.00017.48
8.1.00.0050.00317.56
8.0.300.0000.01018.77
8.0.290.0050.00316.63
8.0.280.0060.00318.40
8.0.270.0000.00717.30
8.0.260.0030.00317.36
8.0.250.0060.00616.99
8.0.240.0070.00017.00
8.0.230.0070.00017.04
8.0.220.0070.00016.89
8.0.210.0000.00817.02
8.0.200.0030.00517.08
8.0.190.0000.00717.05
8.0.180.0040.00417.02
8.0.170.0040.00416.91
8.0.160.0000.00716.89
8.0.150.0000.00716.94
8.0.140.0030.00516.85
8.0.130.0030.00313.45
8.0.120.0040.00417.01
8.0.110.0040.00416.89
8.0.100.0050.00316.99
8.0.90.0030.00617.03
8.0.80.0060.01017.02
8.0.70.0070.00016.97
8.0.60.0000.00817.06
8.0.50.0040.00416.98
8.0.30.0110.00817.05
8.0.20.0120.01017.40
8.0.10.0000.00717.06
8.0.00.0100.01017.07
7.4.330.0020.00215.08
7.4.320.0000.00716.65
7.4.300.0030.00316.61
7.4.290.0030.00316.56
7.4.280.0000.00716.64
7.4.270.0030.00316.49
7.4.260.0000.00716.43
7.4.250.0030.00516.58
7.4.240.0050.00316.62
7.4.230.0040.00416.63
7.4.220.0060.01316.55
7.4.210.0040.01216.58
7.4.200.0070.00016.67
7.4.160.0110.00516.57
7.4.150.0100.01617.40
7.4.140.0070.01417.86
7.4.130.0120.00616.55
7.4.120.0130.00416.55
7.4.110.0090.00916.58
7.4.100.0170.00916.53
7.4.90.0110.01116.56
7.4.80.0180.00919.39
7.4.70.0140.00716.66
7.4.60.0100.01316.67
7.4.50.0080.00316.26
7.4.40.0030.01416.49
7.4.30.0100.00616.64
7.4.00.0070.01015.08
7.3.330.0050.00013.36
7.3.320.0030.00313.21
7.3.310.0000.00716.40
7.3.300.0030.00316.34
7.3.290.0030.00316.27
7.3.280.0130.00516.35
7.3.270.0090.00917.40
7.3.260.0120.00716.40
7.3.250.0110.01016.57
7.3.240.0110.00816.58
7.3.230.0130.00316.50
7.3.210.0080.00816.38
7.3.200.0040.01216.41
7.3.190.0110.00816.54
7.3.180.0100.00516.50
7.3.170.0120.00616.42
7.3.160.0100.01116.41
7.2.330.0090.00916.66
7.2.320.0170.00716.78
7.2.310.0090.01216.89
7.2.300.0090.01116.82
7.2.290.0070.01416.54
7.2.60.0140.00816.62
7.2.00.0060.00919.18
7.1.200.0000.00715.80
7.1.100.0000.01218.31
7.1.70.0000.00916.86
7.1.60.0030.02019.47
7.1.50.0140.01016.89
7.1.00.0070.07322.48
7.0.200.0030.00616.68
7.0.60.0170.06019.94
7.0.50.1100.05720.45
7.0.40.1070.07320.35
7.0.30.0870.06720.46
7.0.20.1070.06020.31
7.0.10.1030.06020.29
7.0.00.1130.06020.28
5.6.280.0000.07720.93
5.6.210.0630.06320.54
5.6.200.0700.06721.18
5.6.190.1000.04321.12
5.6.180.0930.05321.06
5.6.170.0730.07721.05
5.6.160.1030.06020.97
5.6.150.0930.06721.12
5.6.140.0830.06721.11
5.6.130.0930.08021.18
5.6.120.1030.07021.05
5.6.110.1030.06320.95
5.6.100.1130.07721.11
5.6.90.1030.05721.06
5.6.80.0900.05320.35
5.6.70.0900.05320.49
5.6.60.0900.05320.41
5.5.350.1000.06020.52
5.5.340.0800.05720.93
5.5.330.0930.06020.84
5.5.320.0930.05320.86
5.5.310.0970.05020.92
5.5.300.1130.04721.00
5.5.290.0770.06320.84
5.5.280.0630.06320.96
5.5.270.0830.08020.85
5.5.260.1030.08321.02
5.5.250.1000.06020.61
5.5.240.1070.05720.34
5.5.230.1070.07320.36
5.5.220.0830.05720.11
5.5.210.0970.05020.33
5.5.160.1000.06720.20
5.5.150.0730.06320.09
5.5.140.1030.06320.30
5.5.130.0830.05020.15
5.5.120.1000.05320.14
5.5.110.1070.05020.17
5.5.100.1000.07320.11
5.5.90.0900.05020.09
5.5.80.0930.07020.05
5.5.70.0830.06320.09
5.5.60.1070.06020.09
5.5.50.0800.06020.09
5.5.40.0770.05720.02
5.5.30.1130.06720.13
5.5.20.1000.06020.08
5.5.10.1070.06020.06
5.5.00.1130.04020.06

preferences:
65.9 ms | 401 KiB | 5 Q