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() { foreach (array_reverse(func_get_args()) as $it) { $prev = null; if (is_callable($it)) { $prev = $it($prev); } else if (is_object($it)) { $prev = $it; } else { $prev = new $it($prev); } } return $prev; } function cycle($it) { $saved = []; foreach ($it as $key => $val) { $saved[] = $val; yield $val; } while ($saved) { foreach ($saved as $val) { yield $val; } } } function limit($it, $count, $offset = 0) { return new LimitIterator($it, $offset, $count); } function iterator_chunk(\Traversable $it, $chunkSize) { $it->rewind(); $chunk = []; $steps = range(0, $chunkSize); while (true) { foreach ($steps as $_) { if (!$it->valid()) { break 2; } $chunk[] = $it->current(); $it->next(); } yield $chunk; $chunk = []; } if ($chunk) { yield $chunk; } } $it = iterator_chunk( new ArrayIterator(range(0, 125)) , 32); $colors = new ArrayIterator(['red', 'green', 'blue']); foreach (limit(cycle($colors), 10) as $color) { echo "$color\n"; } 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.40.0110.00418.88
8.3.30.0090.00619.03
8.3.20.0080.00020.36
8.3.10.0000.00723.62
8.3.00.0030.00619.50
8.2.170.0070.00722.96
8.2.160.0140.00320.52
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0130.00326.16
8.2.120.0000.00722.32
8.2.110.0160.00622.10
8.2.100.0040.00817.91
8.2.90.0000.00817.91
8.2.80.0050.00317.97
8.2.70.0030.00517.50
8.2.60.0110.00018.04
8.2.50.0080.00018.07
8.2.40.0030.00618.16
8.2.30.0000.00818.11
8.2.20.0000.00817.95
8.2.10.0050.00318.13
8.2.00.0040.00417.95
8.1.270.0060.00323.88
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0100.00022.60
8.1.230.0110.00021.04
8.1.220.0030.00617.78
8.1.210.0080.00018.92
8.1.200.0030.00617.48
8.1.190.0040.00417.64
8.1.180.0060.00318.10
8.1.170.0000.00918.62
8.1.160.0000.00721.99
8.1.150.0060.00318.74
8.1.140.0060.00317.51
8.1.130.0050.00317.80
8.1.120.0000.00717.42
8.1.110.0030.00517.44
8.1.100.0040.00417.41
8.1.90.0040.00417.51
8.1.80.0000.00817.57
8.1.70.0040.00417.43
8.1.60.0050.00317.66
8.1.50.0080.00017.48
8.1.40.0040.00417.64
8.1.30.0000.00817.62
8.1.20.0000.00817.70
8.1.10.0040.00417.62
8.1.00.0040.00417.55
8.0.300.0000.00820.15
8.0.290.0030.00517.18
8.0.280.0000.00718.60
8.0.270.0040.00417.35
8.0.260.0000.00716.95
8.0.250.0060.00316.95
8.0.240.0070.00017.14
8.0.230.0000.00717.06
8.0.220.0070.00017.05
8.0.210.0000.00716.88
8.0.200.0070.00016.93
8.0.190.0000.00917.07
8.0.180.0000.00717.04
8.0.170.0060.00317.07
8.0.160.0050.00217.06
8.0.150.0030.00616.84
8.0.140.0050.00316.95
8.0.130.0030.00313.43
8.0.120.0020.00717.04
8.0.110.0000.00816.98
8.0.100.0000.00717.05
8.0.90.0040.00416.89
8.0.80.0090.00617.06
8.0.70.0040.00417.00
8.0.60.0040.00416.88
8.0.50.0040.00417.01
8.0.30.0090.01017.27
8.0.20.0120.00717.40
8.0.10.0040.00417.20
8.0.00.0100.01116.75
7.4.330.0030.00315.00
7.4.320.0030.00316.59
7.4.300.0000.00716.67
7.4.290.0040.00416.66
7.4.280.0030.00516.66
7.4.270.0050.00316.61
7.4.260.0070.00016.61
7.4.250.0000.00716.52
7.4.240.0040.00416.59
7.4.230.0060.00316.65
7.4.220.0130.00616.61
7.4.210.0060.01116.66
7.4.200.0040.00416.76
7.4.190.0030.00316.75
7.4.160.0040.01716.66
7.4.150.0090.00917.40
7.4.140.0100.01517.86
7.4.130.0110.00716.71
7.4.120.0130.00516.58
7.4.110.0070.01716.46
7.4.100.0110.00716.68
7.4.90.0130.00616.41
7.4.80.0050.01419.39
7.4.70.0010.00516.59
7.4.60.0030.01516.61
7.4.50.0030.00516.48
7.4.40.0000.01522.77
7.4.30.0060.01216.65
7.4.00.0080.01115.10
7.3.330.0000.00513.40
7.3.320.0000.00713.34
7.3.310.0030.00316.51
7.3.300.0030.00316.39
7.3.290.0150.00016.44
7.3.280.0070.01016.46
7.3.270.0160.00617.40
7.3.260.0100.01416.46
7.3.250.0130.00816.58
7.3.240.0150.00316.57
7.3.230.0040.01316.50
7.3.210.0170.00016.51
7.3.200.0070.01719.39
7.3.190.0150.00816.75
7.3.180.0000.02116.52
7.3.170.0110.00716.64
7.3.160.0170.00016.65
7.3.120.0060.01214.90
7.3.110.0090.01114.98
7.3.100.0080.00814.84
7.3.90.0070.00614.84
7.3.80.0030.01215.11
7.3.70.0020.00915.01
7.3.60.0030.01014.90
7.3.50.0090.00514.77
7.3.40.0060.00714.83
7.3.30.0030.01014.82
7.3.20.0050.00716.62
7.3.10.0000.01116.62
7.3.00.0000.01216.74
7.2.330.0180.00016.79
7.2.320.0060.01416.52
7.2.310.0070.01016.57
7.2.300.0120.00616.64
7.2.290.0090.00916.49
7.2.250.0070.01215.33
7.2.240.0080.01315.08
7.2.230.0080.00715.02
7.2.220.0090.00614.98
7.2.210.0030.01215.07
7.2.200.0060.00615.10
7.2.190.0110.00315.15
7.2.180.0050.01115.11
7.2.170.0030.01215.08
7.2.160.0100.00315.06
7.2.150.0060.00616.80
7.2.140.0050.00516.91
7.2.130.0030.01017.01
7.2.120.0080.00317.01
7.2.110.0070.01116.78
7.2.100.0090.00316.90
7.2.90.0030.01216.66
7.2.80.0000.01216.65
7.2.70.0130.00316.64
7.2.60.0060.01016.86
7.2.50.0040.00717.16
7.2.40.0060.00616.99
7.2.30.0000.01417.13
7.2.20.0030.00617.05
7.2.10.0080.00416.70
7.2.00.0050.00718.11
7.1.330.0030.01315.73
7.1.320.0070.00415.79
7.1.310.0090.00515.88
7.1.300.0050.00815.71
7.1.290.0050.00815.62
7.1.280.0080.00715.82
7.1.270.0060.00615.89
7.1.260.0060.00515.60
7.1.250.0100.00715.84
7.1.240.0030.00615.75
7.1.230.0080.00415.93
7.1.220.0060.00915.72
7.1.210.0050.00515.58
7.1.200.0000.00815.61
7.1.190.0040.01115.91
7.1.180.0060.01015.99
7.1.170.0040.00415.72
7.1.160.0040.00815.77
7.1.150.0040.00815.87
7.1.140.0070.00315.59
7.1.130.0040.00415.66
7.1.120.0000.01115.84
7.1.110.0060.00915.95
7.1.100.0030.01016.64
7.1.90.0030.00915.93
7.1.80.0000.01415.86
7.1.70.0050.00416.47
7.1.60.0060.01317.62
7.1.50.0060.00816.49
7.1.40.0000.01515.55
7.1.30.0040.01115.80
7.1.20.0000.01315.91
7.1.10.0000.00915.86
7.1.00.0050.04219.19
7.0.330.0030.01015.47
7.0.320.0060.01015.15
7.0.310.0000.00815.41
7.0.300.0080.00815.47
7.0.290.0100.00315.18
7.0.280.0070.00715.53
7.0.270.0000.01215.45
7.0.260.0090.00615.63
7.0.250.0030.01015.55
7.0.240.0070.00715.57
7.0.230.0000.00815.43
7.0.220.0000.01115.41
7.0.210.0090.00015.43
7.0.200.0050.00716.02
7.0.190.0060.00615.41
7.0.180.0100.00715.58
7.0.170.0090.00315.58
7.0.160.0080.00415.36
7.0.150.0030.01015.55
7.0.140.0030.03918.85
7.0.130.0120.00015.49
7.0.120.0040.00415.63
7.0.110.0030.00815.54
7.0.100.0030.02517.75
7.0.90.0060.03017.60
7.0.80.0070.02117.63
7.0.70.0100.03817.63
7.0.60.0050.04217.83
7.0.50.0100.03817.91
7.0.40.0070.02816.76
7.0.30.0060.04316.82
7.0.20.0060.04216.74
7.0.10.0050.03016.79
7.0.00.0090.04016.66
5.6.400.0070.01014.38
5.6.390.0080.00814.52
5.6.380.0030.00714.76
5.6.370.0060.00314.78
5.6.360.0040.00414.36
5.6.350.0150.00014.55
5.6.340.0070.00714.22
5.6.330.0070.00714.54
5.6.320.0060.00614.44
5.6.310.0000.00814.51
5.6.300.0000.01814.80
5.6.290.0030.01014.81
5.6.280.0090.03517.63
5.6.270.0030.00614.61
5.6.260.0060.00914.38
5.6.250.0090.02017.62
5.6.240.0090.01817.57
5.6.230.0030.02717.73
5.6.220.0110.04117.52
5.6.210.0070.03717.47
5.6.200.0120.03717.65
5.6.190.0090.04617.83
5.6.180.0130.03317.68
5.6.170.0080.04217.69
5.6.160.0100.03917.87
5.6.150.0100.03117.76
5.6.140.0100.04217.85
5.6.130.0060.04817.64
5.6.120.0080.04617.82
5.6.110.0080.02117.63
5.6.100.0080.03717.82
5.6.90.0050.03917.66
5.6.80.0030.04117.28
5.6.70.0090.03917.40
5.6.60.0020.04417.26
5.6.50.0050.03317.40
5.6.40.0070.04217.30
5.6.30.0100.03517.38
5.6.20.0100.04317.56
5.6.10.0070.04317.53
5.6.00.0120.03817.48
5.5.380.0070.02717.48
5.5.370.0070.02717.31
5.5.360.0130.03617.49
5.5.350.0140.03717.28
5.5.340.0070.04417.52
5.5.330.0100.04317.76
5.5.320.0110.03517.68
5.5.310.0070.03217.70
5.5.300.0050.03717.73
5.5.290.0040.02717.76
5.5.280.0090.04517.64
5.5.270.0030.03217.65
5.5.260.0050.04717.52
5.5.250.0060.04317.44
5.5.240.0030.04517.31
5.5.230.0030.04417.19
5.5.220.0080.03317.28
5.5.210.0050.04717.44
5.5.200.0110.03517.21
5.5.190.0070.04217.33
5.5.180.0070.04617.32
5.5.170.0040.00814.46
5.5.160.0050.03017.19
5.5.150.0110.03217.39
5.5.140.0060.04317.22
5.5.130.0110.03817.33
5.5.120.0080.02517.39
5.5.110.0040.04617.45
5.5.100.0080.04217.21
5.5.90.0020.04917.09
5.5.80.0070.04317.22
5.5.70.0070.03817.23
5.5.60.0050.03817.29
5.5.50.0090.04116.94
5.5.40.0050.04817.33
5.5.30.0050.04017.33
5.5.20.0070.04717.23
5.5.10.0080.04317.24
5.5.00.0050.04717.22
5.4.450.0050.04315.80
5.4.440.0070.03315.65
5.4.430.0080.03615.79
5.4.420.0020.04015.78
5.4.410.0080.04015.71
5.4.400.0040.02615.61
5.4.390.0090.03715.49
5.4.380.0080.03815.52
5.4.370.0030.03715.60
5.4.360.0070.03815.67
5.4.350.0100.03515.67
5.4.340.0020.04615.61
5.4.330.0000.00612.08
5.4.320.0030.04115.56
5.4.310.0090.03715.50
5.4.300.0060.03915.49
5.4.290.0040.02715.61
5.4.280.0030.02515.61
5.4.270.0070.03615.56
5.4.260.0040.04115.62
5.4.250.0020.04315.56
5.4.240.0070.02615.46
5.4.230.0060.04015.61
5.4.220.0050.04215.65
5.4.210.0110.03315.49
5.4.200.0050.03515.46
5.4.190.0030.03815.65
5.4.180.0100.03815.62
5.4.170.0070.02915.56
5.4.160.0030.02815.56
5.4.150.0080.02515.64
5.4.140.0050.04214.28
5.4.130.0020.03914.26
5.4.120.0110.01914.21
5.4.110.0050.04014.30
5.4.100.0050.04014.25
5.4.90.0020.03914.32
5.4.80.0050.02614.24
5.4.70.0020.04014.28
5.4.60.0070.02514.19
5.4.50.0100.03214.16
5.4.40.0070.03814.29
5.4.30.0080.03314.16
5.4.20.0030.04214.21
5.4.10.0020.04214.17
5.4.00.0050.04013.97
5.3.290.0030.03113.34
5.3.280.0120.03513.33
5.3.270.0060.04313.37
5.3.260.0070.03813.38
5.3.250.0090.03813.39
5.3.240.0020.04313.37
5.3.230.0010.04313.37
5.3.220.0050.03713.38
5.3.210.0070.03813.38
5.3.200.0050.04213.34
5.3.190.0060.04313.31
5.3.180.0050.04113.35
5.3.170.0070.03813.34
5.3.160.0080.03613.29
5.3.150.0030.02813.31
5.3.140.0030.04013.30
5.3.130.0070.03913.36
5.3.120.0030.03013.39
5.3.110.0030.02513.29
5.3.100.0020.04613.13
5.3.90.0050.04013.10
5.3.80.0050.03813.02
5.3.70.0050.03813.09
5.3.60.0000.04513.01
5.3.50.0050.04013.05
5.3.40.0050.04113.03
5.3.30.0100.03513.04
5.3.20.0090.03512.92
5.3.10.0050.03812.88
5.3.00.0050.04012.87
5.2.170.0100.05711.33
5.2.160.0100.05011.33
5.2.150.0030.06011.33
5.2.140.0070.05311.33
5.2.130.0130.05011.33
5.2.120.0000.05711.33
5.2.110.0100.04311.33
5.2.100.0070.06311.33
5.2.90.0000.06711.33
5.2.80.0070.05711.33
5.2.70.0030.06011.33
5.2.60.0000.06311.33
5.2.50.0100.06011.33
5.2.40.0030.06011.33
5.2.30.0030.06311.33
5.2.20.0070.05711.33
5.2.10.0000.06011.33
5.2.00.0070.05711.33
5.1.60.0130.03311.33
5.1.50.0000.03311.33
5.1.40.0030.04711.33
5.1.30.0030.05711.33
5.1.20.0070.05311.33
5.1.10.0030.05711.33
5.1.00.0030.05311.33
5.0.50.0000.04711.33
5.0.40.0030.04011.33
5.0.30.0130.05311.33
5.0.20.0030.04011.33
5.0.10.0070.04311.33
5.0.00.0000.03711.33
4.4.90.0030.02711.33
4.4.80.0070.03011.33
4.4.70.0100.02711.33
4.4.60.0000.03711.33
4.4.50.0030.02711.33
4.4.40.0030.05311.33
4.4.30.0000.03711.33
4.4.20.0000.03711.33
4.4.10.0070.02311.33
4.4.00.0000.05311.33
4.3.110.0000.03011.33
4.3.100.0000.03711.33
4.3.90.0000.03711.33
4.3.80.0000.03011.33
4.3.70.0100.02711.33
4.3.60.0030.03311.33
4.3.50.0000.04011.33
4.3.40.0000.05311.33
4.3.30.0070.03011.33
4.3.20.0030.03711.33
4.3.10.0000.02011.33
4.3.00.0070.03011.33

preferences:
46.08 ms | 400 KiB | 5 Q