3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generator_chunks(\Generator $generator, $max_chunk_size) { $chunk = []; foreach ($generator as $item) { $chunk[] = $item; if (count($chunk) >= $max_chunk_size) { yield $chunk; $chunk = []; } } if ([] !== $chunk) { // Remaining chunk with fewer items. yield $chunk; } } function generator() { for ($i = 0; $i < 11; ++$i) { yield $i; } } foreach (generator_chunks(generator(), 3) as $chunk) { print json_encode($chunk) . "\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.0070.01116.75
8.3.60.0220.00016.74
8.3.50.0110.00721.13
8.3.40.0170.00018.67
8.3.30.0060.00818.80
8.3.20.0040.00418.91
8.3.10.0040.00421.90
8.3.00.0070.00021.95
8.2.190.0110.00418.29
8.2.180.0160.00616.63
8.2.170.0070.01122.96
8.2.160.0140.00022.13
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00819.83
8.2.120.0050.00326.35
8.2.110.0080.00421.09
8.2.100.0080.00419.21
8.2.90.0070.00019.47
8.2.80.0000.00720.36
8.2.70.0030.00618.04
8.2.60.0090.00018.03
8.2.50.0060.00618.10
8.2.40.0040.00420.65
8.2.30.0050.00319.32
8.2.20.0040.00417.98
8.2.10.0000.00818.05
8.2.00.0000.00717.79
8.1.280.0120.00625.92
8.1.270.0050.00323.65
8.1.260.0040.00428.09
8.1.250.0050.00328.09
8.1.240.0040.00422.18
8.1.230.0060.00620.93
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0050.00317.50
8.1.190.0060.00316.99
8.1.180.0000.00718.10
8.1.170.0050.00320.75
8.1.160.0030.00322.08
8.1.150.0000.00718.89
8.1.140.0050.00319.48
8.1.130.0030.00617.74
8.1.120.0040.00417.46
8.1.110.0030.00517.36
8.1.100.0000.00717.36
8.1.90.0040.00417.36
8.1.80.0040.00417.36
8.1.70.0000.00817.34
8.1.60.0030.00517.57
8.1.50.0080.00017.49
8.1.40.0000.00817.46
8.1.30.0050.00317.62
8.1.20.0040.00417.59
8.1.10.0000.00817.45
8.1.00.0040.00417.47
8.0.300.0070.00019.96
8.0.290.0040.00416.75
8.0.280.0000.00718.39
8.0.270.0040.00416.89
8.0.260.0030.00317.27
8.0.250.0070.00016.93
8.0.240.0000.00816.96
8.0.230.0030.00317.01
8.0.220.0000.00816.86
8.0.210.0000.00816.92
8.0.200.0030.00317.03
8.0.190.0050.00317.00
8.0.180.0050.00216.92
8.0.170.0000.00716.89
8.0.160.0040.00417.06
8.0.150.0000.00716.82
8.0.140.0040.00416.88
8.0.130.0030.00313.37
8.0.120.0040.00416.79
8.0.110.0040.00416.98
8.0.100.0070.00016.99
8.0.90.0030.00516.89
8.0.80.0000.01416.85
8.0.70.0040.00417.01
8.0.60.0040.00416.82
8.0.50.0040.00417.01
8.0.30.0110.00917.25
8.0.20.0110.00717.40
8.0.10.0040.00417.02
8.0.00.0060.01216.94
7.4.330.0030.00315.55
7.4.320.0000.00616.41
7.4.300.0030.00316.66
7.4.290.0050.00216.51
7.4.280.0040.00416.40
7.4.270.0070.00516.53
7.4.260.0040.00416.63
7.4.250.0090.00016.39
7.4.240.0030.00316.63
7.4.230.0000.00716.72
7.4.220.0160.00516.63
7.4.210.0130.00316.51
7.4.200.0000.00716.35
7.4.160.0120.01016.44
7.4.150.0030.01517.40
7.4.140.0110.01117.86
7.4.130.0100.00816.55
7.4.120.0140.00416.44
7.4.110.0070.01016.69
7.4.100.0080.00916.48
7.4.90.0100.00716.61
7.4.80.0070.01419.39
7.4.70.0060.01016.45
7.4.60.0080.00816.32
7.4.50.0040.01116.34
7.4.40.0120.00616.53
7.4.30.0130.00316.62
7.4.00.0050.00914.95
7.3.330.0030.00313.15
7.3.320.0050.00013.32
7.3.310.0030.00316.22
7.3.300.0070.00016.37
7.3.290.0080.00716.42
7.3.280.0090.00616.34
7.3.270.0130.01017.40
7.3.260.0150.00516.27
7.3.250.0110.00616.57
7.3.240.0120.00616.54
7.3.230.0110.00616.54
7.3.210.0090.00916.52
7.3.200.0130.00416.42
7.3.190.0080.00816.39
7.3.180.0140.00416.66
7.3.170.0030.01416.29
7.3.160.0110.00716.51
7.3.120.0060.01214.91
7.3.110.0000.01814.87
7.3.100.0060.00714.93
7.3.90.0070.00715.09
7.3.80.0030.01115.10
7.3.70.0080.00614.71
7.3.60.0070.00714.85
7.3.50.0070.00814.71
7.3.40.0070.00814.62
7.3.30.0050.00914.81
7.3.20.0210.00615.32
7.3.10.0380.01115.58
7.3.00.0260.00815.51
7.2.330.0110.00816.86
7.2.320.0040.01416.80
7.2.310.0130.01016.79
7.2.300.0130.01016.84
7.2.290.0150.00916.78
7.2.250.0110.00714.92
7.2.240.0030.01615.25
7.2.230.0080.00714.84
7.2.220.0080.00715.00
7.2.210.0090.00715.05
7.2.200.0100.00315.06
7.2.190.0030.01014.99
7.2.180.0030.01014.77
7.2.170.0020.01314.91
7.2.160.0090.00614.96
7.2.150.0390.00414.86
7.2.140.0470.00415.07
7.2.130.0220.00615.41
7.2.120.0270.00815.44
7.2.110.0200.00815.42
7.2.100.0450.00515.34
7.2.90.0370.00715.27
7.2.80.0880.01015.29
7.2.70.0750.00815.43
7.2.60.1080.00815.57
7.2.50.1090.00915.57
7.2.40.0920.00715.43
7.2.30.0920.00715.36
7.2.20.1050.00515.36
7.2.10.0920.00915.39
7.2.00.0890.00616.06
7.1.330.0070.00715.61
7.1.320.0070.00615.01
7.1.310.0080.00814.87
7.1.300.0070.00614.91
7.1.290.0030.00814.88
7.1.280.0070.00814.97
7.1.270.0180.00914.34
7.1.260.0280.00514.61
7.1.250.0210.00814.36
7.1.240.0290.00813.99
7.1.230.0760.00813.96
7.1.220.1400.00613.90
7.1.210.0980.00613.89
7.1.200.0270.00714.28
7.1.190.0960.01013.87
7.1.180.1650.00913.77
7.1.170.1850.00813.93
7.1.160.1550.00413.93
7.1.150.1590.00713.93
7.1.140.1380.00513.79
7.1.130.1220.00713.96
7.1.120.1250.00813.94
7.1.110.0870.00913.91
7.1.100.1130.00613.94
7.1.90.0640.01013.89
7.1.80.0600.00913.96
7.1.70.1060.00614.61
7.1.60.0580.00818.18
7.1.50.0840.00618.28
7.1.40.0640.00818.26
7.1.30.0670.00718.31
7.1.20.0650.00818.50
7.1.10.0650.00513.81
7.1.00.0610.01515.59
7.0.330.0260.01113.56
7.0.320.0350.00313.49
7.0.310.0960.00713.50
7.0.300.1740.00713.54
7.0.290.1450.00613.59
7.0.280.1350.00713.58
7.0.270.1420.00813.64
7.0.260.1160.00813.64
7.0.250.1000.00813.56
7.0.240.0920.00713.69
7.0.230.0810.00613.62
7.0.220.0780.00813.58
7.0.210.0700.00713.59
7.0.200.0650.00614.24
7.0.190.0790.00413.61
7.0.180.0630.00513.67
7.0.170.0590.00413.54
7.0.160.0610.00813.53
7.0.150.0500.00713.64
7.0.140.0670.00913.61
7.0.130.0700.00813.71
7.0.120.0490.02015.32
7.0.110.0460.02315.24
7.0.100.0520.02115.28
7.0.90.0540.02315.22
7.0.80.0500.01915.31
7.0.70.0520.02215.22
7.0.60.0530.01815.36
7.0.50.0550.02215.29
7.0.40.0510.01815.37
7.0.30.0520.01915.39
7.0.20.0670.01615.33
7.0.10.0520.01815.32
7.0.00.0560.01915.33
5.6.400.0160.00514.20
5.6.390.0170.00914.26
5.6.380.0160.00914.40
5.6.370.0140.01114.40
5.6.360.0160.00914.49
5.6.350.0120.00714.36
5.6.340.0110.01214.40
5.6.330.0110.01214.45
5.6.320.0150.00814.57
5.6.310.0090.01014.50
5.6.300.0200.00514.37
5.6.290.0100.00914.45
5.6.280.0110.00714.40
5.6.270.0130.02315.85
5.6.260.0130.01915.77
5.6.250.0090.02115.82
5.6.240.0130.02315.70
5.6.230.0120.02415.66
5.6.220.0130.01715.65
5.6.210.0100.02315.63
5.6.200.0110.02215.70
5.6.190.0110.02115.69
5.6.180.0090.02415.73
5.6.170.0130.01715.63
5.6.160.0120.01715.72
5.6.150.0110.02315.54
5.6.140.0120.02415.67
5.6.130.0080.02615.66
5.6.120.0130.02115.62
5.6.110.0090.02115.63
5.6.100.0100.02015.76
5.6.90.0100.01515.65
5.6.80.0120.02315.44
5.6.70.0120.02115.59
5.6.60.0090.02315.53
5.6.50.0100.02015.63
5.6.40.0120.01715.51
5.6.30.0130.01815.42
5.6.20.0120.01615.49
5.6.10.0100.01915.47
5.6.00.0120.01915.50

preferences:
18.89 ms | 401 KiB | 5 Q