3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! function iterator_compose(\Traversable $source, $steps) { $gen = $source; foreach ($steps as $step) { if (is_array($step) and !is_callable($step)) { $g = array_shift($step); array_unshift($step, $gen); if (class_exists($g)) { $class = new \ReflectionClass($className); $gen = $class->newInstanceArgs($step); } else if (is_callable($g)) { $gen = call_user_func_array($g, $step); } } else if (is_callable($step)) { $gen = $step($gen); } } return $gen; } function iterator_chunk(\Traversable $it, $chunkSize) { $it->rewind(); $chunk = []; $steps = range(1, $chunkSize); while (true) { foreach ($steps as $_) { if (!$it->valid()) { break 2; } $chunk[] = $it->current(); $it->next(); } yield $chunk; $chunk = []; } if ($chunk) { yield $chunk; } } $steps = [ function($it) { foreach ($it as $val) { echo "Value: $val\n"; yield $val; } }, ["iterator_chunk", 32], ]; $it = iterator_compose(new \ArrayIterator(range(0, 127)), $steps); foreach ($it as $i => $c) { echo "====== Chunk $i ======\n"; var_export($c); 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.0150.00521.14
8.3.40.0090.00618.87
8.3.30.0100.00622.02
8.3.20.0080.00020.69
8.3.10.0050.00321.09
8.3.00.0080.00023.50
8.2.180.0110.00716.63
8.2.170.0110.00422.96
8.2.160.0140.00720.39
8.2.150.0120.00324.18
8.2.140.0040.01124.66
8.2.130.0040.00426.16
8.2.120.0040.00421.19
8.2.110.0100.00019.20
8.2.100.0090.00317.91
8.2.90.0050.00319.26
8.2.80.0000.00719.32
8.2.70.0030.00517.75
8.2.60.0040.00417.93
8.2.50.0120.00018.07
8.2.40.0030.00518.30
8.2.30.0040.00419.45
8.2.20.0040.00417.79
8.2.10.0000.00817.86
8.2.00.0040.00417.70
8.1.280.0120.00325.92
8.1.270.0050.00323.99
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0040.00920.82
8.1.230.0040.00820.88
8.1.220.0050.00518.77
8.1.210.0040.00419.04
8.1.200.0060.00317.50
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0080.00018.46
8.1.160.0000.00718.91
8.1.150.0050.00218.71
8.1.140.0030.00517.47
8.1.130.0040.00417.95
8.1.120.0040.00417.49
8.1.110.0030.00517.38
8.1.100.0030.00517.44
8.1.90.0080.00017.52
8.1.80.0050.00317.37
8.1.70.0000.00717.46
8.1.60.0060.00317.50
8.1.50.0070.00317.34
8.1.40.0060.00317.53
8.1.30.0050.00317.59
8.1.20.0060.00317.59
8.1.10.0060.00317.59
8.1.00.0050.00317.53
8.0.300.0030.00619.97
8.0.290.0070.00017.16
8.0.280.0000.00718.35
8.0.270.0040.00417.30
8.0.260.0070.00016.82
8.0.250.0060.00316.98
8.0.240.0090.00017.00
8.0.230.0000.00717.00
8.0.220.0050.00316.99
8.0.210.0000.00716.98
8.0.200.0070.00017.06
8.0.190.0070.00016.91
8.0.180.0050.00217.00
8.0.170.0080.00017.05
8.0.160.0000.00817.05
8.0.150.0040.00416.96
8.0.140.0040.00416.85
8.0.130.0000.00613.43
8.0.120.0000.00816.93
8.0.110.0080.00016.85
8.0.100.0050.00516.98
8.0.90.0050.00216.88
8.0.80.0100.00616.89
8.0.70.0000.00716.76
8.0.60.0000.00816.98
8.0.50.0040.00416.87
8.0.30.0120.00717.09
8.0.20.0150.00517.40
8.0.10.0050.00317.00
8.0.00.0150.00716.94
7.4.330.0030.00314.98
7.4.320.0030.00316.53
7.4.300.0020.00516.62
7.4.290.0040.00416.61
7.4.280.0000.00716.44
7.4.270.0050.00316.64
7.4.260.0000.00913.32
7.4.250.0030.00516.47
7.4.240.0000.00716.55
7.4.230.0030.00316.61
7.4.220.0070.01416.73
7.4.210.0090.00616.62
7.4.200.0040.00416.63
7.4.190.0040.00316.70
7.4.160.0060.01216.29
7.4.150.0060.01217.40
7.4.140.0100.01017.86
7.4.130.0090.00916.63
7.4.120.0090.00816.53
7.4.110.0100.00716.48
7.4.100.0110.01116.59
7.4.90.0090.00916.46
7.4.80.0110.00819.39
7.4.70.0060.01216.51
7.4.60.0140.00316.62
7.4.50.0000.00916.58
7.4.40.0000.01522.77
7.4.30.0150.00316.64
7.4.10.0070.01015.06
7.4.00.0050.01115.15
7.3.330.0030.00313.43
7.3.320.0030.00313.54
7.3.310.0040.00416.32
7.3.300.0030.00316.33
7.3.290.0040.01116.42
7.3.280.0100.00816.42
7.3.270.0120.00617.40
7.3.260.0090.01018.24
7.3.250.0120.00816.58
7.3.240.0150.00416.37
7.3.230.0060.01216.66
7.3.210.0110.00716.49
7.3.200.0090.00919.39
7.3.190.0040.01416.34
7.3.180.0100.00716.34
7.3.170.0070.01516.41
7.3.160.0060.01216.69
7.3.130.0060.01314.84
7.3.120.0100.00514.97
7.3.110.0070.00715.08
7.3.100.0000.01414.93
7.3.90.0060.00914.84
7.3.80.0040.00814.79
7.3.70.0060.00614.77
7.3.60.0070.00714.98
7.3.50.0060.00914.94
7.3.40.0040.00814.92
7.3.30.0140.00014.88
7.3.20.0100.00616.89
7.3.10.0080.00516.69
7.3.00.0100.00416.84
7.2.330.0110.00816.76
7.2.320.0160.00516.74
7.2.310.0060.01116.82
7.2.300.0110.00816.84
7.2.290.0070.01016.84
7.2.260.0120.00615.10
7.2.250.0130.00315.25
7.2.240.0040.01215.28
7.2.230.0000.01415.31
7.2.220.0030.01115.05
7.2.210.0030.01314.84
7.2.200.0000.01214.99
7.2.190.0030.00915.16
7.2.180.0060.00915.11
7.2.170.0100.00714.85
7.2.160.0030.00715.28
7.2.150.0060.00616.88
7.2.140.0000.01417.11
7.2.130.0070.00816.90
7.2.120.0080.00816.79
7.2.110.0090.00816.98
7.2.100.0030.00816.78
7.2.90.0040.01017.02
7.2.80.0090.00516.95
7.2.70.0050.00817.00
7.2.60.0040.01016.81
7.2.50.0030.01316.82
7.2.40.0080.00316.88
7.2.30.0090.00517.01
7.2.20.0070.00617.08
7.2.10.0070.00716.93
7.2.00.0070.00916.95
7.1.330.0060.01115.71
7.1.320.0030.01315.71
7.1.310.0000.01415.68
7.1.300.0090.00615.76
7.1.290.0060.00315.97
7.1.280.0050.00515.47
7.1.270.0060.00315.85
7.1.260.0030.01015.81
7.1.250.0050.00915.79
7.1.240.0060.00615.93
7.1.230.0060.00315.63
7.1.220.0000.01415.88
7.1.210.0070.01015.80
7.1.200.0060.00615.75
7.1.190.0060.00615.95
7.1.180.0070.00715.71
7.1.170.0110.00315.95
7.1.160.0060.00615.91
7.1.150.0120.00315.77
7.1.140.0030.00615.68
7.1.130.0000.01215.58
7.1.120.0030.00615.93
7.1.110.0130.00315.79
7.1.100.0040.00715.74
7.1.90.0040.00815.88
7.1.80.0040.01415.81
7.1.70.0080.00416.52
7.1.60.0050.01016.56
7.1.50.0050.01216.46
7.1.40.0120.00015.55
7.1.30.0070.01015.88
7.1.20.0100.00715.81
7.1.10.0110.00415.75
7.1.00.0070.02019.04
7.0.330.0060.00815.42
7.0.320.0070.00415.50
7.0.310.0000.01315.29
7.0.300.0100.00315.46
7.0.290.0000.00815.65
7.0.280.0070.00715.27
7.0.270.0090.00415.19
7.0.260.0060.00615.20
7.0.250.0000.00815.63
7.0.240.0000.00915.59
7.0.230.0070.00715.58
7.0.220.0090.00615.29
7.0.210.0120.00315.56
7.0.200.0060.01016.15
7.0.190.0030.00615.34
7.0.180.0040.01115.61
7.0.170.0060.00915.53
7.0.160.0130.00315.50
7.0.150.0060.00915.46
7.0.140.0030.03918.66
7.0.130.0120.00315.41
7.0.120.0090.00615.15
7.0.110.0080.00615.53
7.0.100.0040.00915.34
7.0.90.0060.00915.28
7.0.80.0070.00715.48
7.0.70.0050.02218.66
7.0.60.0090.04218.50
7.0.50.0020.04918.81
7.0.40.0040.03716.87
7.0.30.0050.04816.88
7.0.20.0050.04516.81
7.0.10.0050.04016.87
7.0.00.0080.04316.83
5.6.400.0000.01014.73
5.6.390.0030.01314.59
5.6.380.0040.01114.24
5.6.370.0030.01014.52
5.6.360.0030.00914.23
5.6.350.0070.00714.78
5.6.340.0090.00014.66
5.6.330.0080.00514.14
5.6.320.0080.00814.48
5.6.310.0060.00914.10
5.6.300.0060.01214.54
5.6.290.0030.01014.46
5.6.280.0060.00914.60
5.6.270.0070.01014.62
5.6.260.0060.00614.52
5.6.250.0030.01014.51
5.6.240.0040.00814.39
5.6.230.0090.00914.83
5.6.220.0070.04117.44
5.6.210.0070.03817.60
5.6.200.0030.04517.86
5.6.190.0030.02917.74
5.6.180.0040.04917.77
5.6.170.0030.04317.83
5.6.160.0060.02717.73
5.6.150.0050.04217.94
5.6.140.0060.02517.77
5.6.130.0030.02617.77
5.6.120.0060.03517.82
5.6.110.0020.02717.78
5.6.100.0020.03217.69
5.6.90.0030.03017.83
5.6.80.0020.02517.39
5.6.70.0070.04317.45
5.6.60.0030.04117.44
5.6.50.0040.04617.61
5.6.40.0070.04517.48
5.6.30.0050.04217.53
5.6.20.0000.04917.56
5.6.10.0030.02017.45
5.6.00.0040.01917.56
5.5.380.0000.01214.43
5.5.370.0060.00614.47
5.5.360.0050.04717.65
5.5.350.0040.03717.51
5.5.340.0030.02517.51
5.5.330.0030.03617.71
5.5.320.0080.04517.76
5.5.310.0000.04617.77
5.5.300.0050.03017.71
5.5.290.0030.03317.79
5.5.280.0030.03817.62
5.5.270.0030.03517.54
5.5.260.0100.02117.61
5.5.250.0020.02717.70
5.5.240.0030.02117.32
5.5.230.0050.04617.20
5.5.220.0030.02317.37
5.5.210.0070.04317.29
5.5.200.0020.04717.32
5.5.190.0080.03917.29
5.5.180.0110.04217.35
5.5.170.0060.00614.39
5.5.160.0000.03117.42
5.5.150.0050.04717.15
5.5.140.0030.04117.45
5.5.130.0050.02417.36
5.5.120.0060.04117.30
5.5.110.0070.04217.35
5.5.100.0050.02217.21
5.5.90.0060.03317.34
5.5.80.0040.04117.27
5.5.70.0060.03017.36
5.5.60.0030.04317.19
5.5.50.0020.04517.14
5.5.40.0070.02217.29
5.5.30.0050.03817.38
5.5.20.0030.02817.05
5.5.10.0020.04317.19
5.5.00.0070.04317.34
5.4.450.0030.02015.10
5.4.440.0030.04415.26
5.4.430.0050.01915.26
5.4.420.0030.03815.22
5.4.410.0030.03115.11
5.4.400.0070.02715.11
5.4.390.0050.03315.02
5.4.380.0030.03815.08
5.4.370.0020.03014.98
5.4.360.0020.04715.02
5.4.350.0050.02715.01
5.4.340.0000.04515.07
5.4.330.0030.00810.99
5.4.320.0060.03014.92
5.4.310.0000.04615.12
5.4.300.0030.02515.01
5.4.290.0000.04515.06
5.4.280.0020.04515.02
5.4.270.0050.02315.01
5.4.260.0020.02715.02
5.4.250.0060.03415.10
5.4.240.0020.03714.93
5.4.230.0050.03815.04
5.4.220.0030.04415.04
5.4.210.0030.03915.11
5.4.200.0060.03814.94
5.4.190.0020.02315.04
5.4.180.0050.03815.11
5.4.170.0030.03314.91
5.4.160.0020.03514.93
5.4.150.0050.04015.01
5.4.140.0020.04313.63
5.4.130.0000.02613.74
5.4.120.0050.02813.75
5.4.110.0070.03013.67
5.4.100.0000.04113.69
5.4.90.0050.02413.74
5.4.80.0020.02613.78
5.4.70.0050.03513.76
5.4.60.0030.02213.72
5.4.50.0090.02813.66
5.4.40.0030.03513.73
5.4.30.0030.03113.62
5.4.20.0020.03713.70
5.4.10.0070.03513.62
5.4.00.0040.03613.44
5.3.290.0070.04013.39
5.3.280.0020.04113.39
5.3.270.0050.02313.39
5.3.260.0000.04213.39
5.3.250.0020.03913.39
5.3.240.0060.03613.39
5.3.230.0070.03813.39
5.3.220.0040.01913.39
5.3.210.0020.03613.39
5.3.200.0070.02913.39
5.3.190.0020.02213.39
5.3.180.0070.03513.39
5.3.170.0030.03813.39
5.3.160.0070.03313.39
5.3.150.0050.02513.39
5.3.140.0040.03613.39
5.3.130.0060.04213.39
5.3.120.0000.04513.39
5.3.110.0050.03113.39
5.3.100.0030.02313.39
5.3.90.0020.03413.39
5.3.80.0040.02213.39
5.3.70.0000.02313.39
5.3.60.0090.03513.39
5.3.50.0040.03913.39
5.3.40.0000.04013.39
5.3.30.0020.02213.39
5.3.20.0020.02713.39
5.3.10.0030.03513.39
5.3.00.0040.01713.39
5.2.170.0030.02715.79
5.2.160.0030.05715.79
5.2.150.0030.04315.79
5.2.140.0030.03015.79
5.2.130.0000.03315.79
5.2.120.0070.02315.79
5.2.110.0030.02715.79
5.2.100.0000.06015.79
5.2.90.0000.03315.79
5.2.80.0000.04715.79
5.2.70.0030.06315.79
5.2.60.0000.04715.79
5.2.50.0000.04015.79
5.2.40.0000.03015.79
5.2.30.0070.06015.79
5.2.20.0000.05715.79
5.2.10.0000.03315.79
5.2.00.0070.04315.79
5.1.60.0030.05015.79
5.1.50.0030.05015.79
5.1.40.0000.04315.79
5.1.30.0030.03015.79
5.1.20.0000.05715.79
5.1.10.0000.02715.79
5.1.00.0000.05715.79
5.0.50.0030.02715.79
5.0.40.0000.04315.79
5.0.30.0070.06015.79
5.0.20.0000.02015.79
5.0.10.0000.03715.79
5.0.00.0000.03715.79
4.4.90.0000.03715.79
4.4.80.0030.03015.79
4.4.70.0000.03715.79
4.4.60.0030.01715.79
4.4.50.0030.02715.79
4.4.40.0070.05015.79
4.4.30.0000.03315.79
4.4.20.0000.02315.79
4.4.10.0000.02715.79
4.4.00.0000.03015.79
4.3.110.0000.01715.79
4.3.100.0000.03315.79
4.3.90.0000.03015.79
4.3.80.0000.02315.79
4.3.70.0000.01315.79
4.3.60.0070.02315.79
4.3.50.0000.01715.79
4.3.40.0000.05315.79
4.3.30.0070.03015.79
4.3.20.0030.02315.79
4.3.10.0030.03015.79
4.3.00.0070.03015.79

preferences:
50.96 ms | 401 KiB | 5 Q