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($source, $steps) { foreach (array_reverse($steps) as $step) { $gen = $source; 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 = [ ["iterator_chunk", 32], function($it) { foreach ($it as $val) { yield ord($val); } } ]; $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.00718.29
8.3.50.0110.00722.06
8.3.40.0040.01118.84
8.3.30.0070.00719.21
8.3.20.0040.00420.25
8.3.10.0080.00023.53
8.3.00.0060.00320.95
8.2.180.0110.00416.63
8.2.170.0000.01522.96
8.2.160.0070.00720.44
8.2.150.0110.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00419.36
8.2.110.0030.00622.24
8.2.100.0030.00918.22
8.2.90.0050.00319.21
8.2.80.0030.00617.97
8.2.70.0050.00317.75
8.2.60.0050.00517.93
8.2.50.0060.00318.07
8.2.40.0000.01019.97
8.2.30.0040.00418.33
8.2.20.0040.00417.71
8.2.10.0050.00218.14
8.2.00.0090.00019.59
8.1.280.0130.00725.92
8.1.270.0040.00422.19
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.77
8.1.230.0070.00419.01
8.1.220.0080.00017.75
8.1.210.0080.00018.77
8.1.200.0000.00917.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0000.00918.67
8.1.160.0060.00322.05
8.1.150.0040.00418.68
8.1.140.0040.00417.52
8.1.130.0040.00417.91
8.1.120.0070.00317.39
8.1.110.0040.00417.52
8.1.100.0080.00017.41
8.1.90.0000.00717.53
8.1.80.0020.00517.41
8.1.70.0000.00717.48
8.1.60.0060.00317.61
8.1.50.0030.00517.55
8.1.40.0060.00317.55
8.1.30.0000.00817.59
8.1.20.0060.00317.57
8.1.10.0030.00517.62
8.1.00.0040.00417.46
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.46
8.0.270.0000.00717.28
8.0.260.0030.00317.21
8.0.250.0030.00317.02
8.0.240.0050.00317.02
8.0.230.0050.00217.11
8.0.220.0070.00016.98
8.0.210.0000.00717.03
8.0.200.0030.00316.93
8.0.190.0000.00817.03
8.0.180.0030.00716.98
8.0.170.0060.00317.02
8.0.160.0040.00417.04
8.0.150.0070.00016.90
8.0.140.0030.00316.83
8.0.130.0000.00613.34
8.0.120.0030.00616.91
8.0.110.0040.00416.91
8.0.100.0080.00017.02
8.0.90.0020.00517.02
8.0.80.0100.01116.98
8.0.70.0040.00416.94
8.0.60.0000.00716.90
8.0.50.0070.00016.94
8.0.30.0150.00717.31
8.0.20.0090.01017.40
8.0.10.0050.00217.14
8.0.00.0080.01316.80
7.4.330.0000.00515.17
7.4.320.0030.00316.48
7.4.300.0060.00016.54
7.4.290.0080.00016.43
7.4.280.0030.00516.63
7.4.270.0040.00416.54
7.4.260.0090.00316.52
7.4.250.0040.00416.49
7.4.240.0040.00416.53
7.4.230.0040.00416.70
7.4.220.0100.01016.73
7.4.210.0070.01316.43
7.4.200.0050.00316.66
7.4.160.0080.00816.59
7.4.150.0040.01317.40
7.4.140.0150.00617.86
7.4.130.0120.01016.55
7.4.120.0060.01216.63
7.4.110.0130.00516.44
7.4.100.0120.00916.50
7.4.90.0060.01316.58
7.4.80.0170.00719.39
7.4.70.0100.00716.58
7.4.60.0030.01316.59
7.4.50.0030.00316.45
7.4.40.0070.01016.58
7.4.30.0070.01016.53
7.4.00.0070.00415.16
7.3.330.0000.00713.46
7.3.320.0050.00013.45
7.3.310.0030.00416.31
7.3.300.0080.00016.43
7.3.290.0030.01016.46
7.3.280.0130.00716.46
7.3.270.0100.00717.40
7.3.260.0170.00716.59
7.3.250.0080.01116.59
7.3.240.0040.01516.53
7.3.230.0040.01316.46
7.3.210.0090.00916.31
7.3.200.0120.00619.39
7.3.190.0150.00416.46
7.3.180.0090.00616.50
7.3.170.0120.00416.53
7.3.160.0070.01016.51
7.3.120.0030.01214.85
7.3.00.0030.01316.47
7.2.330.0150.00316.80
7.2.320.0060.01116.51
7.2.310.0140.00316.75
7.2.300.0130.01016.48
7.2.290.0130.01016.87
7.2.130.0000.01517.00
7.2.120.0000.01317.10
7.2.110.0070.01317.00
7.2.100.0000.01316.94
7.2.90.0030.01017.15
7.2.80.0060.00816.76
7.2.70.0030.01217.16
7.2.60.0050.00716.84
7.2.50.0090.00616.99
7.2.40.0030.01216.82
7.2.30.0080.00617.09
7.2.20.0120.00616.96
7.2.10.0000.01517.01
7.2.00.0070.00317.84
7.1.250.0060.00715.98
7.1.240.0040.00816.05
7.1.230.0060.01215.63
7.1.220.0110.00415.87
7.1.210.0030.01015.84
7.1.200.0060.00315.72
7.1.190.0030.01016.00
7.1.180.0030.01315.64
7.1.170.0050.00515.75
7.1.160.0040.01115.93
7.1.150.0080.00815.83
7.1.140.0080.00815.80
7.1.130.0090.00615.61
7.1.120.0070.00715.53
7.1.110.0090.00615.87
7.1.100.0080.00716.97
7.1.90.0110.00315.86
7.1.80.0030.01015.91
7.1.70.0030.00516.60
7.1.60.0050.00817.74
7.1.50.0050.01216.30
7.1.40.0030.01015.70
7.1.30.0000.01115.77
7.1.20.0060.00915.48
7.1.10.0040.00815.95
7.1.00.0030.04219.00
7.0.330.0030.00915.54
7.0.320.0070.01015.18
7.0.310.0030.01015.46
7.0.300.0090.00415.20
7.0.290.0040.00715.41
7.0.280.0000.00915.32
7.0.270.0030.00815.45
7.0.260.0080.00815.60
7.0.250.0120.00315.45
7.0.240.0000.01015.59
7.0.230.0100.00015.46
7.0.220.0040.00815.48
7.0.210.0100.00315.56
7.0.200.0080.00315.95
7.0.190.0040.00715.48
7.0.180.0040.01215.59
7.0.170.0080.00415.14
7.0.160.0040.00415.47
7.0.150.0110.00015.41
7.0.140.0020.04218.73
7.0.130.0030.00615.20
7.0.120.0030.00715.36
7.0.110.0030.00715.32
7.0.100.0060.00615.60
7.0.90.0090.00015.61
7.0.80.0040.00415.34
7.0.70.0040.01115.43
7.0.60.0080.04218.62
7.0.50.0030.04318.71
7.0.40.0050.04516.76
7.0.30.0050.03816.82
7.0.20.0120.03716.63
7.0.10.0120.03716.85
7.0.00.0000.04016.85
5.6.380.0060.00314.30
5.6.370.0030.00714.46
5.6.360.0100.00014.80
5.6.350.0030.00714.66
5.6.340.0100.00714.69
5.6.330.0070.00714.70
5.6.320.0090.00614.54
5.6.310.0060.00814.82
5.6.300.0080.00514.39
5.6.290.0070.00314.60
5.6.280.0100.00314.49
5.6.270.0040.00414.82
5.6.260.0000.01014.79
5.6.250.0060.00314.46
5.6.240.0060.00614.41
5.6.230.0030.00714.46
5.6.220.0100.00014.71
5.6.210.0050.04117.47
5.6.200.0050.04717.81
5.6.190.0080.04217.82
5.6.180.0060.03317.80
5.6.170.0030.04917.90
5.6.160.0030.02517.71
5.6.150.0030.02317.84
5.6.140.0050.04317.73
5.6.130.0100.03817.69
5.6.120.0030.04017.76
5.6.110.0020.05017.81
5.6.100.0030.04817.74
5.6.90.0050.04217.64
5.6.80.0070.03717.48
5.6.70.0030.04317.49
5.6.60.0060.03817.52
5.6.50.0050.04017.43
5.6.40.0030.03417.48
5.6.30.0060.04517.33
5.6.20.0040.04017.51
5.6.10.0080.04017.42
5.6.00.0080.02617.45
5.5.380.0000.00711.24
5.5.370.0030.00311.29
5.5.360.0030.00611.34
5.5.350.0000.04616.00
5.5.340.0040.04215.87
5.5.330.0020.04316.29
5.5.320.0060.03816.17
5.5.310.0080.03816.04
5.5.300.0010.02516.04
5.5.290.0020.04516.13
5.5.280.0060.04015.91
5.5.270.0050.03315.92
5.5.260.0060.03616.05
5.5.250.0030.04216.01
5.5.240.0030.04315.76
5.5.230.0060.04015.79
5.5.220.0030.02715.65
5.5.210.0030.04415.80
5.5.200.0020.04315.78
5.5.190.0100.04015.61
5.5.180.0050.04415.64
5.5.170.0040.00411.04
5.5.160.0070.03715.81
5.5.150.0060.03715.74
5.5.140.0040.04415.87
5.5.130.0020.04515.85
5.5.120.0090.03715.62
5.5.110.0050.04515.65
5.5.100.0040.02415.83
5.5.90.0070.03515.63
5.5.80.0040.04315.72
5.5.70.0050.04015.61
5.5.60.0050.04015.75
5.5.50.0030.03715.65
5.5.40.0060.03515.66
5.5.30.0020.04715.72
5.5.20.0030.04215.60
5.5.10.0050.03715.53
5.5.00.0050.03215.61
5.4.450.0030.02815.25
5.4.440.0030.04215.27
5.4.430.0050.04015.21
5.4.420.0070.03815.31
5.4.410.0070.04215.12
5.4.400.0100.03314.96
5.4.390.0040.04414.95
5.4.380.0030.04015.04
5.4.370.0030.03615.03
5.4.360.0040.04015.06
5.4.350.0080.04015.03
5.4.340.0060.04115.11
5.4.330.0030.00711.00
5.4.320.0050.04015.01
5.4.310.0020.03915.09
5.4.300.0070.04015.10
5.4.290.0030.03715.11
5.4.280.0020.04215.06
5.4.270.0050.03915.11
5.4.260.0050.03514.96
5.4.250.0010.03915.03
5.4.240.0030.04315.08
5.4.230.0030.03914.96
5.4.220.0030.03815.11
5.4.210.0020.04015.06
5.4.200.0030.02815.03
5.4.190.0050.03315.03
5.4.180.0120.03415.04
5.4.170.0050.04015.00
5.4.160.0050.03615.05
5.4.150.0030.04115.07
5.4.140.0020.03713.75
5.4.130.0030.03613.75
5.4.120.0040.04113.75
5.4.110.0040.02913.74
5.4.100.0000.04013.79
5.4.90.0030.03813.72
5.4.80.0030.04113.79
5.4.70.0030.03713.80
5.4.60.0060.03613.67
5.4.50.0060.03613.67
5.4.40.0040.04113.64
5.4.30.0080.02613.71
5.4.20.0100.03313.60
5.4.10.0040.03113.76
5.4.00.0000.02813.44
5.3.290.0020.04212.86
5.3.280.0050.03512.78
5.3.270.0020.04512.79
5.3.260.0020.03312.83
5.3.250.0020.03812.84
5.3.240.0030.04312.83
5.3.230.0000.02712.78
5.3.220.0060.03912.84
5.3.210.0020.03812.74
5.3.200.0020.03312.84
5.3.190.0030.03812.84
5.3.180.0030.03712.79
5.3.170.0030.03012.81
5.3.160.0050.04012.81
5.3.150.0050.03512.77
5.3.140.0050.02212.74
5.3.130.0060.03112.80
5.3.120.0010.04412.80
5.3.110.0050.04212.80
5.3.100.0070.03512.51
5.3.90.0080.03412.50
5.3.80.0050.02812.51
5.3.70.0000.04112.51
5.3.60.0020.04212.51
5.3.50.0070.03712.50
5.3.40.0030.03612.51
5.3.30.0030.03812.49
5.3.20.0030.04112.39
5.3.10.0080.02212.36
5.3.00.0010.02412.32
5.2.170.0010.03311.10
5.2.160.0030.03011.02
5.2.150.0000.03511.10
5.2.140.0020.03411.13
5.2.130.0030.03411.09
5.2.120.0040.03011.10
5.2.110.0030.01611.08
5.2.100.0070.02511.04
5.2.90.0050.01610.98
5.2.80.0050.01411.09
5.2.70.0050.01711.07
5.2.60.0040.01511.06
5.2.50.0040.01511.04
5.2.40.0020.01311.03
5.2.30.0020.01710.92
5.2.20.0000.01611.02
5.2.10.0020.01510.86
5.2.00.0020.01510.91
5.1.60.0020.01410.54
5.1.50.0010.01410.50
5.1.40.0050.01510.53
5.1.30.0020.01310.60
5.1.20.0000.01910.63
5.1.10.0030.01010.58
5.1.00.0030.01110.46
5.0.50.0020.0119.86
5.0.40.0000.0129.86
5.0.30.0020.0159.86
5.0.20.0000.0129.86
5.0.10.0010.0149.86
5.0.00.0000.0169.86
4.4.90.0000.0109.86
4.4.80.0030.0089.86
4.4.70.0010.0089.86
4.4.60.0010.0089.86
4.4.50.0050.0059.86
4.4.40.0000.0139.86
4.4.30.0020.0089.86
4.4.20.0000.0099.86
4.4.10.0030.0079.86
4.4.00.0020.0139.86
4.3.110.0000.0099.86
4.3.100.0000.0099.86
4.3.90.0020.0089.86
4.3.80.0020.0129.86
4.3.70.0010.0089.86
4.3.60.0000.0079.86
4.3.50.0020.0079.86
4.3.40.0000.0159.86
4.3.30.0010.0089.86
4.3.20.0000.0109.86
4.3.10.0000.0129.86
4.3.00.0020.0089.86

preferences:
43.43 ms | 401 KiB | 5 Q