3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! function iterator_pipeline(\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; } } function iterator_consume(\Traversable $it) { foreach ($it as $key => $value) {} } function iterator_pass(\Traversable $it) { foreach ($it as $key => $value) { yield $key => $value; } } $steps = [ function($it) { foreach ($it as $val) { yield chr($val); } }, "iterator_pass", ["iterator_chunk", 32], function($it) { foreach ($it as $val) { print_r($val); yield $val; } } ]; $it = iterator_pipeline(new \ArrayIterator(range(0, 127)), $steps); iterator_consume($it);

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.0090.00918.55
8.3.50.0030.01522.11
8.3.40.0110.00418.96
8.3.30.0000.01418.83
8.3.20.0080.00018.90
8.3.10.0060.00320.34
8.3.00.0100.00017.75
8.2.180.0110.00716.38
8.2.170.0140.00722.96
8.2.160.0110.00422.19
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.77
8.2.110.0110.00022.07
8.2.100.0090.00318.03
8.2.90.0050.00317.63
8.2.80.0000.00917.97
8.2.70.0030.00617.78
8.2.60.0000.00818.05
8.2.50.0040.00418.10
8.2.40.0080.00020.59
8.2.30.0040.00419.89
8.2.20.0090.00017.82
8.2.10.0030.00517.87
8.2.00.0060.00317.92
8.1.280.0110.00425.92
8.1.270.0070.00023.99
8.1.260.0080.00026.35
8.1.250.0040.01128.09
8.1.240.0070.00320.89
8.1.230.0090.00322.72
8.1.220.0050.00517.91
8.1.210.0030.00518.77
8.1.200.0050.00517.48
8.1.190.0040.00717.23
8.1.180.0050.00318.10
8.1.170.0000.00818.77
8.1.160.0000.00718.86
8.1.150.0040.00418.62
8.1.140.0040.00417.50
8.1.130.0050.00317.83
8.1.120.0000.00717.48
8.1.110.0110.00017.58
8.1.100.0000.00717.59
8.1.90.0050.00217.50
8.1.80.0040.00417.57
8.1.70.0040.00417.43
8.1.60.0040.00417.53
8.1.50.0080.00017.41
8.1.40.0030.00617.48
8.1.30.0080.00017.71
8.1.20.0040.00417.65
8.1.10.0080.00017.67
8.1.00.0040.00417.45
8.0.300.0060.00321.68
8.0.290.0000.00817.00
8.0.280.0000.00718.42
8.0.270.0040.00417.26
8.0.260.0030.00318.68
8.0.250.0080.00017.10
8.0.240.0030.00717.14
8.0.230.0070.00317.07
8.0.220.0000.00717.09
8.0.210.0000.00717.02
8.0.200.0040.00417.14
8.0.190.0040.00416.97
8.0.180.0040.00417.07
8.0.170.0040.00417.01
8.0.160.0000.00716.89
8.0.150.0050.00316.85
8.0.140.0100.00016.87
8.0.130.0000.00613.41
8.0.120.0000.00717.07
8.0.110.0040.00417.14
8.0.100.0000.00716.82
8.0.90.0040.00416.91
8.0.80.0030.01517.05
8.0.70.0040.00416.93
8.0.60.0030.00516.91
8.0.50.0050.00217.08
8.0.30.0100.01216.91
8.0.20.0100.00917.43
8.0.10.0000.00717.19
8.0.00.0100.01116.79
7.4.330.0050.00014.84
7.4.320.0000.00616.58
7.4.300.0030.00316.70
7.4.290.0000.00816.67
7.4.280.0070.00016.65
7.4.270.0000.00716.56
7.4.260.0000.00513.35
7.4.250.0000.00816.48
7.4.240.0040.00416.68
7.4.230.0000.00716.74
7.4.220.0090.00916.71
7.4.210.0080.00816.59
7.4.200.0040.00416.67
7.4.190.0030.00516.53
7.4.160.0100.00716.69
7.4.150.0080.01117.40
7.4.140.0110.01217.15
7.4.130.0110.00816.63
7.4.120.0120.00816.59
7.4.110.0070.01016.49
7.4.100.0090.00916.56
7.4.90.0150.00316.57
7.4.80.0030.01319.03
7.4.70.0100.01316.50
7.4.60.0030.01316.54
7.4.50.0060.00316.40
7.4.40.0070.01022.27
7.4.30.0100.00616.56
7.4.00.0040.01214.99
7.3.330.0000.00613.51
7.3.320.0000.00513.39
7.3.310.0000.00716.36
7.3.300.0030.00316.41
7.3.290.0140.00716.48
7.3.280.0060.01116.48
7.3.270.0140.00317.40
7.3.260.0070.01418.24
7.3.250.0090.00916.44
7.3.240.0110.00616.41
7.3.230.0090.00916.64
7.3.210.0060.01216.47
7.3.200.0120.00919.39
7.3.190.0100.00616.68
7.3.180.0100.00616.67
7.3.170.0180.00016.56
7.3.160.0100.00716.70
7.3.120.0070.01014.90
7.3.110.0130.00514.91
7.3.100.0070.01214.91
7.3.90.0090.00514.91
7.3.80.0030.01214.80
7.3.70.0070.00615.02
7.3.60.0070.00514.80
7.3.50.0060.01014.74
7.3.40.0050.00814.80
7.3.30.0050.00714.86
7.3.20.0090.00716.79
7.3.10.0110.00716.64
7.3.00.0080.00816.76
7.2.330.0120.00916.59
7.2.320.0100.00716.68
7.2.310.0090.01016.89
7.2.300.0060.01216.82
7.2.290.0090.00916.95
7.2.250.0030.01315.09
7.2.240.0030.01315.30
7.2.230.0070.00814.83
7.2.220.0080.00914.97
7.2.210.0050.01215.01
7.2.200.0040.01015.12
7.2.190.0050.00715.05
7.2.180.0050.01115.04
7.2.170.0020.01115.15
7.2.160.0110.00615.02
7.2.150.0060.00816.88
7.2.140.0070.01016.88
7.2.130.0080.00817.06
7.2.120.0030.01416.90
7.2.110.0030.00916.89
7.2.100.0090.00817.00
7.2.90.0050.01016.94
7.2.80.0050.01016.94
7.2.70.0020.01117.00
7.2.60.0050.00816.99
7.2.50.0070.00716.97
7.2.40.0040.01016.87
7.2.30.0050.00617.01
7.2.20.0070.00916.82
7.2.10.0090.00717.05
7.2.00.0020.01217.08
7.1.330.0040.01315.89
7.1.320.0070.01015.83
7.1.310.0020.01115.90
7.1.300.0100.00515.79
7.1.290.0080.00815.90
7.1.280.0050.00615.81
7.1.270.0070.00515.68
7.1.260.0060.01015.85
7.1.250.0030.01215.79
7.1.240.0080.00815.92
7.1.230.0060.00715.55
7.1.220.0060.00715.83
7.1.210.0050.01015.86
7.1.200.0080.00515.85
7.1.190.0090.00515.66
7.1.180.0050.00715.73
7.1.170.0060.00515.85
7.1.160.0100.00415.82
7.1.150.0090.00515.75
7.1.140.0000.01415.64
7.1.130.0030.01115.80
7.1.120.0050.01015.92
7.1.110.0070.00815.76
7.1.100.0020.01215.82
7.1.90.0080.00515.86
7.1.80.0010.01015.93
7.1.70.0050.00716.21
7.1.60.0020.01416.94
7.1.50.0070.00916.20
7.1.40.0080.00615.79
7.1.30.0040.00815.86
7.1.20.0070.00415.88
7.1.10.0040.00915.90
7.1.00.0030.02917.94
7.0.330.0060.00715.10
7.0.320.0050.00915.37
7.0.310.0050.00915.47
7.0.300.0050.00815.26
7.0.290.0030.00815.42
7.0.280.0050.01215.50
7.0.270.0050.00715.46
7.0.260.0050.00915.49
7.0.250.0050.00815.33
7.0.240.0060.00915.24
7.0.230.0070.00915.50
7.0.220.0050.01215.45
7.0.210.0070.00515.38
7.0.200.0130.00715.29
7.0.190.0080.00615.39
7.0.180.0060.00815.21
7.0.170.0070.00915.41
7.0.160.0080.00615.48
7.0.150.0060.01215.44
7.0.140.0100.02817.56
7.0.130.0080.00515.51
7.0.120.0070.01015.63
7.0.110.0050.01015.45
7.0.100.0030.01015.40
7.0.90.0110.00715.45
7.0.80.0080.00915.38
7.0.70.0030.01215.44
7.0.60.0060.02916.96
7.0.50.0090.03116.35
7.0.40.0100.03815.72
7.0.30.0120.03015.72
7.0.20.0170.03015.79
7.0.10.0120.03315.67
7.0.00.0160.03415.75
5.6.400.0060.00914.50
5.6.390.0060.01014.70
5.6.380.0070.00714.54
5.6.370.0030.01314.35
5.6.360.0080.00614.51
5.6.350.0050.00814.42
5.6.340.0070.00714.79
5.6.330.0050.00914.51
5.6.320.0070.00914.59
5.6.310.0130.00214.39
5.6.300.0100.00714.55
5.6.290.0070.00914.42
5.6.280.0040.03316.69
5.6.270.0020.01214.68
5.6.260.0030.01214.37
5.6.250.0070.00514.79
5.6.240.0040.01014.28
5.6.230.0060.01114.50
5.6.220.0120.00614.38
5.6.210.0070.01716.45
5.6.200.0020.03115.87
5.6.190.0140.03316.52
5.6.180.0140.02816.34
5.6.170.0130.03516.60
5.6.160.0150.03116.44
5.6.150.0160.02816.28
5.6.140.0130.02316.39
5.6.130.0100.02316.56
5.6.120.0130.02816.61
5.6.110.0100.02016.46
5.6.100.0160.02816.34
5.6.90.0100.02916.41
5.6.80.0130.03116.06
5.6.70.0140.02616.10
5.6.60.0150.03216.16
5.6.50.0110.02516.21
5.6.40.0120.03216.18
5.6.30.0080.02416.00
5.6.20.0140.03016.04
5.6.10.0120.03316.08
5.6.00.0110.02316.12
5.5.380.0060.01014.69
5.5.370.0040.01414.42
5.5.360.0130.00714.42
5.5.350.1170.01516.36
5.5.340.0060.02215.61
5.5.330.0130.02716.29
5.5.320.0190.02916.40
5.5.310.0110.03516.33
5.5.300.0190.01716.42
5.5.290.0090.03616.48
5.5.280.0140.03616.26
5.5.270.0120.03516.41
5.5.260.0140.03516.42
5.5.250.0160.02816.20
5.5.240.0150.03016.00
5.5.230.0200.02516.07
5.5.220.0140.02316.17
5.5.210.0120.02216.08
5.5.200.0150.03015.99
5.5.190.0170.03216.09
5.5.180.0160.02116.15
5.5.170.0120.00714.38
5.5.160.0110.02415.97
5.5.150.0140.03715.92
5.5.140.0150.02016.10
5.5.130.0110.02616.04
5.5.120.0140.02915.96
5.5.110.0130.03515.90
5.5.100.0200.02615.99
5.5.90.0120.03316.16
5.5.80.0100.03415.82
5.5.70.0090.02115.86
5.5.60.0150.02215.78
5.5.50.0140.01516.08
5.5.40.0070.02215.91
5.5.30.0180.02815.90
5.5.20.0140.02015.89
5.5.10.0130.02315.99
5.5.00.0060.02315.90
5.4.450.0120.01614.92
5.4.440.0110.02414.84
5.4.430.0130.02714.94
5.4.420.0120.02914.89
5.4.410.0090.01914.84
5.4.400.0090.01914.85
5.4.390.0090.01614.73
5.4.380.0080.02714.75
5.4.370.0090.02914.79
5.4.360.0110.02014.80
5.4.350.0080.01814.75
5.4.340.0110.02914.74
5.4.330.0060.00512.67
5.4.320.0110.02814.78
5.4.310.0150.02514.86
5.4.300.0120.02814.84
5.4.290.0170.02214.83
5.4.280.0110.02514.77
5.4.270.0080.03014.75
5.4.260.0130.02614.87
5.4.250.0100.02714.73
5.4.240.0110.02814.72
5.4.230.0130.02314.84
5.4.220.0080.01914.77
5.4.210.0080.01814.73
5.4.200.0100.01714.83
5.4.190.0100.03014.80
5.4.180.0050.02414.72
5.4.170.0090.01814.77
5.4.160.0090.01814.72
5.4.150.0080.01814.82
5.4.140.0070.01613.90
5.4.130.0050.01813.92
5.4.120.0060.01713.93
5.4.110.0060.01613.98
5.4.100.0050.01613.94
5.4.90.0050.03113.97
5.4.80.0040.02513.92
5.4.70.0140.02213.93
5.4.60.0080.01813.91
5.4.50.0090.01513.87
5.4.40.0070.01613.91
5.4.30.0090.01613.94
5.4.20.0050.01913.91
5.4.10.0100.01813.91
5.4.00.0110.01413.69
5.3.290.0150.02513.34
5.3.280.0090.01613.33
5.3.270.0100.02013.33
5.3.260.0080.01513.32
5.3.250.0110.01613.32
5.3.240.0110.01413.37
5.3.230.0050.01813.31
5.3.220.0080.01513.35
5.3.210.0050.01713.32
5.3.200.0090.01813.32
5.3.190.0120.02713.30
5.3.180.0020.02113.32
5.3.170.0090.01813.30
5.3.160.0070.01613.30
5.3.150.0060.01813.32
5.3.140.0110.01313.31
5.3.130.0060.01813.30
5.3.120.0060.01813.29
5.3.110.0150.01313.29
5.3.100.0070.01813.14
5.3.90.0070.01813.13
5.3.80.0070.01513.17
5.3.70.0100.01513.11
5.3.60.0130.01313.08
5.3.50.0030.02113.08
5.3.40.0080.01813.10
5.3.30.0090.01413.10
5.3.20.0080.01313.02
5.3.10.0080.01412.96
5.3.00.0100.01213.01
5.2.170.0100.03012.84
5.2.160.0070.04012.84
5.2.150.0230.02312.84
5.2.140.0130.02712.84
5.2.130.0070.03012.84
5.2.120.0100.03312.84
5.2.110.0130.02712.84
5.2.100.0130.02312.84
5.2.90.0070.03012.84
5.2.80.0200.02312.84
5.2.70.0070.03312.84
5.2.60.0070.03312.84
5.2.50.0030.03312.84
5.2.40.0130.02712.84
5.2.30.0130.02312.84
5.2.20.0070.03012.84
5.2.10.0170.04012.84
5.2.00.0200.05712.84
5.1.60.0170.03712.84
5.1.50.0200.01712.84
5.1.40.0170.04012.84
5.1.30.0200.06712.84
5.1.20.0200.05012.84
5.1.10.0170.04312.84
5.1.00.0070.06012.84
5.0.50.0130.04312.84
5.0.40.0100.03012.84
5.0.30.0070.03712.84
5.0.20.0030.02312.84
5.0.10.0070.04012.84
5.0.00.0370.04012.84
4.4.90.0030.01712.84
4.4.80.0030.02012.84
4.4.70.0070.01312.84
4.4.60.0070.02012.84
4.4.50.0070.02012.84
4.4.40.0130.03712.84
4.4.30.0030.02012.84
4.4.20.0030.02312.84
4.4.10.0100.03312.84
4.4.00.0100.05312.84
4.3.110.0070.02712.84
4.3.100.0130.03012.84
4.3.90.0270.02312.84
4.3.80.0070.03712.84
4.3.70.0130.03012.84
4.3.60.0130.02012.84
4.3.50.0030.02312.84
4.3.40.0070.02312.84
4.3.30.0030.01312.84
4.3.20.0030.04012.84
4.3.10.0030.03712.84
4.3.00.0000.02712.84

preferences:
54.01 ms | 400 KiB | 5 Q