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) { foreach ($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 = [ function($it) { foreach ($it as $val) { yield chr($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.70.0090.00616.59
8.3.60.0070.00716.61
8.3.50.0110.01018.39
8.3.40.0040.01118.96
8.3.30.0140.00018.98
8.3.20.0000.00818.77
8.3.10.0090.00020.65
8.3.00.0150.00019.51
8.2.180.0120.00625.92
8.2.170.0060.01218.89
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0020.00526.16
8.2.120.0060.00318.67
8.2.110.0030.00619.27
8.2.100.0040.00718.03
8.2.90.0070.00419.47
8.2.80.0070.00019.34
8.2.70.0080.00017.63
8.2.60.0030.00618.04
8.2.50.0120.00018.07
8.2.40.0060.00318.28
8.2.30.0020.00518.05
8.2.20.0090.00017.64
8.2.10.0000.00817.75
8.2.00.0080.00017.70
8.1.280.0070.00725.92
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00621.86
8.1.230.0000.01222.66
8.1.220.0000.00817.74
8.1.210.0090.00018.91
8.1.200.0070.00317.35
8.1.190.0070.00017.51
8.1.180.0030.00618.10
8.1.170.0040.00418.91
8.1.160.0000.00718.96
8.1.150.0000.00818.66
8.1.140.0040.00417.48
8.1.130.0000.00717.86
8.1.120.0040.00417.43
8.1.110.0020.00517.36
8.1.100.0000.00817.49
8.1.90.0000.00717.52
8.1.80.0000.00717.49
8.1.70.0070.00017.45
8.1.60.0030.00617.60
8.1.50.0040.00417.39
8.1.40.0000.00817.52
8.1.30.0030.00717.61
8.1.20.0040.00417.63
8.1.10.0040.00417.61
8.1.00.0050.00317.54
8.0.300.0000.00819.98
8.0.290.0000.00816.75
8.0.280.0000.00818.46
8.0.270.0070.00017.20
8.0.260.0000.00716.79
8.0.250.0040.00417.06
8.0.240.0070.00017.07
8.0.230.0030.00316.91
8.0.220.0070.00016.92
8.0.210.0000.00716.88
8.0.200.0030.00317.00
8.0.190.0040.00416.93
8.0.180.0000.00717.01
8.0.170.0030.00616.89
8.0.160.0040.00316.95
8.0.150.0000.00816.95
8.0.140.0040.00416.79
8.0.130.0040.00413.41
8.0.120.0040.00417.00
8.0.110.0000.00816.85
8.0.100.0050.00316.86
8.0.90.0050.00316.97
8.0.80.0120.00316.94
8.0.70.0030.00516.92
8.0.60.0000.00816.86
8.0.50.0040.00417.09
8.0.30.0130.00616.98
8.0.20.0060.01316.97
8.0.10.0000.00717.15
8.0.00.0130.00816.80
7.4.330.0020.00212.95
7.4.320.0020.00516.40
7.4.300.0050.00516.63
7.4.290.0000.00716.48
7.4.280.0000.00816.60
7.4.270.0070.00016.67
7.4.260.0050.00013.27
7.4.250.0000.00816.48
7.4.240.0000.00716.52
7.4.230.0040.00416.64
7.4.220.0060.01216.72
7.4.210.0040.01116.53
7.4.200.0000.00716.39
7.4.190.0000.00716.53
7.4.160.0170.00316.60
7.4.150.0130.00416.74
7.4.140.0140.01016.53
7.4.130.0160.00316.41
7.4.120.0060.00916.60
7.4.110.0110.01116.68
7.4.100.0090.00916.63
7.4.90.0170.00016.64
7.4.80.0070.01119.39
7.4.70.0080.01116.55
7.4.60.0060.00916.62
7.4.50.0030.00516.31
7.4.40.0040.01516.56
7.4.30.0100.00716.31
7.4.00.0030.00915.05
7.3.330.0030.00313.44
7.3.320.0030.00313.30
7.3.310.0050.00216.51
7.3.300.0030.00316.33
7.3.290.0090.00916.43
7.3.280.0070.01016.45
7.3.270.0150.00616.62
7.3.260.0100.00716.44
7.3.250.0050.01316.55
7.3.240.0130.01016.43
7.3.230.0130.00316.37
7.3.210.0100.01016.45
7.3.200.0080.00816.44
7.3.190.0150.00616.59
7.3.180.0110.00716.62
7.3.170.0060.00916.49
7.3.160.0090.00616.48
7.3.120.0090.00614.77
7.3.10.0060.00616.49
7.3.00.0040.01116.79
7.2.330.0040.01816.83
7.2.320.0090.00916.80
7.2.310.0120.00616.80
7.2.300.0160.01216.78
7.2.290.0150.00316.74
7.2.130.0070.01116.98
7.2.120.0100.00716.91
7.2.110.0040.01116.98
7.2.100.0000.01316.83
7.2.90.0070.00317.04
7.2.80.0110.00316.96
7.2.70.0070.01017.06
7.2.60.0060.00617.04
7.2.50.0100.00316.98
7.2.40.0060.01216.94
7.2.30.0100.00617.06
7.2.20.0030.01016.81
7.2.10.0100.00316.77
7.2.00.0060.00718.04
7.1.250.0060.00315.75
7.1.240.0070.00715.66
7.1.230.0000.01215.73
7.1.220.0080.00615.66
7.1.210.0000.01315.69
7.1.200.0090.00315.77
7.1.190.0110.00415.71
7.1.180.0130.00315.51
7.1.170.0070.00315.75
7.1.160.0040.01115.77
7.1.150.0120.00315.63
7.1.140.0040.00815.81
7.1.130.0030.00715.67
7.1.120.0030.01015.60
7.1.110.0060.00315.59
7.1.100.0050.00617.01
7.1.90.0000.01415.92
7.1.80.0070.00715.79
7.1.70.0020.00616.43
7.1.60.0020.01016.48
7.1.50.0050.00916.44
7.1.40.0000.01315.68
7.1.30.0030.00615.86
7.1.20.0070.00715.79
7.1.10.0070.00715.64
7.1.00.0020.02319.13
7.0.330.0040.01215.46
7.0.320.0060.00315.26
7.0.310.0070.00715.48
7.0.300.0040.00815.33
7.0.290.0070.00415.48
7.0.280.0030.01015.32
7.0.270.0000.01515.47
7.0.260.0030.00915.48
7.0.250.0000.01015.45
7.0.240.0060.00315.41
7.0.230.0080.00315.62
7.0.220.0030.00815.57
7.0.210.0080.00415.57
7.0.200.0030.00716.08
7.0.190.0040.00415.21
7.0.180.0080.00415.49
7.0.170.0090.00615.23
7.0.160.0030.00615.53
7.0.150.0000.01215.25
7.0.140.0020.04718.71
7.0.130.0040.01115.52
7.0.120.0030.03918.84
7.0.110.0070.00715.26
7.0.100.0000.01415.07
7.0.90.0000.01715.42
7.0.80.0060.00615.31
7.0.70.0030.01315.46
7.0.60.0110.03717.71
7.0.50.0060.04016.66
7.0.40.0050.04816.69
7.0.30.0290.03916.80
7.0.20.0190.04116.79
7.0.10.0050.03616.85
7.0.00.0080.04116.91
5.6.380.0030.00614.57
5.6.370.0110.00314.65
5.6.360.0120.00314.49
5.6.350.0080.00414.68
5.6.340.0030.01414.53
5.6.330.0030.00914.61
5.6.320.0040.00814.73
5.6.310.0040.01114.40
5.6.300.0040.01114.52
5.6.290.0080.00514.54
5.6.280.0070.04017.68
5.6.270.0110.00314.32
5.6.260.0000.01214.48
5.6.250.0030.01014.29
5.6.240.0070.00714.51
5.6.230.0110.00014.51
5.6.220.0040.00714.53
5.6.210.0060.04417.63
5.6.200.0050.03716.42
5.6.190.0030.03417.55
5.6.180.0150.03117.46
5.6.170.0120.03217.39
5.6.160.0100.03517.50
5.6.150.0080.04016.30
5.6.140.0090.03216.35
5.6.130.0090.04716.29
5.6.120.0070.04217.56
5.6.110.0120.04217.83
5.6.100.0040.02517.84
5.6.90.0030.04017.56
5.6.80.0080.04117.31
5.6.70.0100.00714.33
5.6.60.0060.00614.67
5.6.50.0030.01014.23
5.6.40.0070.00714.43
5.6.30.0150.00014.48
5.6.20.0100.00614.65
5.6.10.0000.01514.55
5.6.00.0040.00714.28
5.5.380.0080.00311.59
5.5.370.0060.00611.40
5.5.360.0100.00011.56
5.5.350.0050.04315.92
5.5.340.0130.03814.61
5.5.330.0070.04215.88
5.5.320.0170.03015.62
5.5.310.0170.04215.71
5.5.300.0030.04514.53
5.5.290.0050.03214.58
5.5.280.0070.04415.80
5.5.270.0030.04215.92
5.5.260.0050.04016.11
5.5.250.0020.04316.02
5.5.240.0170.03515.68
5.5.230.0060.00010.85
5.5.220.0070.00310.97
5.5.210.0060.00611.02
5.5.200.0000.01311.26
5.5.190.0000.00711.25
5.5.180.0040.00411.26
5.5.170.0060.00611.25
5.5.160.0060.00611.29
5.5.150.0050.00511.40
5.5.140.0040.00711.42
5.5.130.0030.00310.82
5.5.120.0040.00711.38
5.5.110.0030.00611.36
5.5.100.0080.00011.23
5.5.90.0030.00311.30
5.5.80.0030.00310.94
5.5.70.0000.01111.31
5.5.60.0000.01011.32
5.5.50.0060.00011.05
5.5.40.0080.00011.23
5.5.30.0030.00711.38
5.5.20.0080.00311.36
5.5.10.0080.00311.35
5.5.00.0000.01111.21
5.4.450.0110.03515.14
5.4.440.0110.03815.15
5.4.430.0060.02715.17
5.4.420.0050.04315.23
5.4.410.0110.03515.12
5.4.400.0020.03614.81
5.4.390.0050.02714.83
5.4.380.0030.04214.90
5.4.370.0070.03814.97
5.4.360.0030.04014.78
5.4.350.0020.04515.04
5.4.340.0050.03815.00
5.4.330.0000.00911.05
5.4.320.0050.03814.85
5.4.310.0020.03614.93
5.4.300.0120.03415.12
5.4.290.0090.02914.97
5.4.280.0100.02314.89
5.4.270.0050.02515.01
5.4.260.0110.03615.04
5.4.250.0040.02714.91
5.4.240.0090.01614.94
5.4.230.0040.04014.97
5.4.220.0070.03314.94
5.4.210.0080.03314.96
5.4.200.0030.04314.95
5.4.190.0070.03315.07
5.4.180.0050.04514.93
5.4.170.0050.03014.79
5.4.160.0030.03015.05
5.4.150.0060.02114.91
5.4.140.0020.02313.52
5.4.130.0030.03213.56
5.4.120.0000.03313.57
5.4.110.0030.02213.90
5.4.100.0050.02013.65
5.4.90.0030.03913.57
5.4.80.0050.03913.57
5.4.70.0020.03913.75
5.4.60.0050.02813.66
5.4.50.0080.03113.65
5.4.40.0070.03513.68
5.4.30.0030.04113.65
5.4.20.0110.03813.61
5.4.10.0070.02813.51
5.4.00.0060.03513.24
5.3.290.0070.03812.77
5.3.280.0020.02312.65
5.3.270.0060.04112.61
5.3.260.0050.02812.67
5.3.250.0030.02712.70
5.3.240.0020.02412.60
5.3.230.0080.02112.65
5.3.220.0070.02312.64
5.3.210.0000.02612.72
5.3.200.0000.03212.66
5.3.190.0070.03312.66
5.3.180.0060.04112.65
5.3.170.0040.04012.64
5.3.160.0070.03712.72
5.3.150.0030.04012.58
5.3.140.0030.04212.63
5.3.130.0080.04212.65
5.3.120.0100.03212.59
5.3.110.0030.04012.67
5.3.100.0060.02612.40
5.3.90.0050.04212.37
5.3.80.0090.02612.44
5.3.70.0090.02912.44
5.3.60.0090.03012.36
5.3.50.0020.02812.32
5.3.40.0050.03912.37
5.3.30.0070.03512.33
5.3.20.0020.03912.20
5.3.10.0050.03712.20
5.3.00.0020.03212.17
5.2.170.0020.03610.93
5.2.160.0050.01610.97
5.2.150.0000.02310.97
5.2.140.0010.03610.91
5.2.130.0070.02910.94
5.2.120.0030.03310.93
5.2.110.0040.03410.92
5.2.100.0050.02610.91
5.2.90.0030.03110.98
5.2.80.0100.02510.98
5.2.70.0020.02710.98
5.2.60.0010.03310.89
5.2.50.0030.03310.81
5.2.40.0030.02210.82
5.2.30.0000.04010.88
5.2.20.0000.02510.84
5.2.10.0020.03710.75
5.2.00.0040.03410.70
5.1.60.0050.01710.37
5.1.50.0030.01610.39
5.1.40.0040.02510.34
5.1.30.0050.02810.52
5.1.20.0020.03110.61
5.1.10.0040.03010.47
5.1.00.0070.02810.38
5.0.50.0030.0189.66
5.0.40.0050.0239.60
5.0.30.0000.0239.46
5.0.20.0080.0119.45
5.0.10.0030.0109.46
5.0.00.0030.0339.43
4.4.90.0040.0209.31
4.4.80.0000.0219.31
4.4.70.0030.0109.31
4.4.60.0040.0139.31
4.4.50.0000.0129.31
4.4.40.0020.0159.31
4.4.30.0010.0219.31
4.4.20.0020.0239.31
4.4.10.0070.0129.31
4.4.00.0040.0259.31
4.3.110.0080.0129.31
4.3.100.0000.0219.31
4.3.90.0030.0209.31
4.3.80.0000.0259.31
4.3.70.0000.0159.31
4.3.60.0050.0189.31
4.3.50.0000.0209.31
4.3.40.0020.0279.31
4.3.30.0020.0139.31
4.3.20.0050.0179.31
4.3.10.0050.0129.31
4.3.00.0030.0129.31

preferences:
51.91 ms | 401 KiB | 5 Q