3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("STOP",99); function generate_ints($n){ foreach ( range(0,$n-1) as $number) { yield $number; } } $gen = generate_ints(5); // iterable object can be used in foreach foreach ($gen as $g) { $c = $gen->current(); echo $c; if ($c == 4) { $gen->send(STOP); // injecting a value to stop the generator; } }

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.0140.00718.55
8.3.50.0270.00321.27
8.3.40.0110.00318.66
8.3.30.0070.00720.17
8.3.20.0050.00320.39
8.3.10.0080.00021.00
8.3.00.0050.00223.48
8.2.180.0080.00816.38
8.2.170.0090.00922.96
8.2.160.0160.00320.39
8.2.150.0080.00024.18
8.2.140.0120.00624.66
8.2.130.0050.00326.16
8.2.120.0040.00421.05
8.2.110.0080.00019.27
8.2.100.0090.00317.84
8.2.90.0080.00019.22
8.2.80.0040.00419.38
8.2.70.0040.00417.61
8.2.60.0060.00317.80
8.2.50.0110.00018.07
8.2.40.0040.00418.22
8.2.30.0000.00719.39
8.2.20.0070.00017.65
8.2.10.0000.00717.76
8.2.00.0000.00717.76
8.1.280.0140.00325.92
8.1.270.0020.00523.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00620.45
8.1.230.0060.00621.09
8.1.220.0030.00618.77
8.1.210.0040.00418.79
8.1.200.0030.00617.35
8.1.190.0080.00017.55
8.1.180.0000.00818.10
8.1.170.0040.00418.63
8.1.160.0040.00418.89
8.1.150.0070.00318.70
8.1.140.0040.00417.51
8.1.130.0030.00317.71
8.1.120.0000.00717.47
8.1.110.0040.00417.40
8.1.100.0040.00317.36
8.1.90.0000.00717.36
8.1.80.0000.00717.45
8.1.70.0030.00317.44
8.1.60.0030.00517.59
8.1.50.0000.00817.47
8.1.40.0050.00217.61
8.1.30.0070.00017.64
8.1.20.0040.00417.67
8.1.10.0080.00017.44
8.1.00.0050.00317.49
8.0.300.0030.00619.90
8.0.290.0060.00317.29
8.0.280.0030.00318.50
8.0.270.0000.00717.14
8.0.260.0000.00816.75
8.0.250.0040.00416.95
8.0.240.0030.00616.86
8.0.230.0040.00417.00
8.0.220.0000.00716.80
8.0.210.0040.00416.93
8.0.200.0030.00316.85
8.0.190.0070.00016.94
8.0.180.0020.00516.89
8.0.170.0070.00016.92
8.0.160.0070.00016.94
8.0.150.0040.00416.79
8.0.140.0060.00316.76
8.0.130.0000.00613.31
8.0.120.0040.00416.80
8.0.110.0000.00816.77
8.0.100.0070.00016.77
8.0.90.0070.00016.77
8.0.80.0110.00416.79
8.0.70.0070.00016.79
8.0.60.0050.00316.77
8.0.50.0000.00716.80
8.0.30.0100.00917.16
8.0.20.0080.01317.40
8.0.10.0000.00816.88
8.0.00.0110.01116.80
7.4.330.0050.00016.83
7.4.320.0060.00316.42
7.4.300.0060.00016.66
7.4.290.0040.00416.50
7.4.280.0000.00716.40
7.4.270.0030.00316.50
7.4.260.0040.00413.16
7.4.250.0080.00016.58
7.4.240.0030.00316.50
7.4.230.0030.00316.41
7.4.220.0060.01316.52
7.4.210.0110.00716.60
7.4.200.0000.00716.26
7.4.190.0040.00416.51
7.4.160.0120.00416.61
7.4.150.0070.01017.40
7.4.140.0150.00717.86
7.4.130.0140.00316.52
7.4.120.0040.01316.60
7.4.110.0170.00716.50
7.4.100.0070.01016.47
7.4.90.0150.00916.59
7.4.80.0090.01519.39
7.4.70.0140.00316.46
7.4.60.0080.00816.65
7.4.50.0060.00316.41
7.4.40.0100.00722.77
7.4.30.0120.00916.41
7.4.00.0120.00315.02
7.3.330.0020.00213.18
7.3.320.0000.00513.39
7.3.310.0040.00416.42
7.3.300.0030.00316.32
7.3.290.0080.00516.35
7.3.280.0130.00416.35
7.3.270.0160.00717.40
7.3.260.0140.00718.24
7.3.250.0110.01116.48
7.3.240.0030.01616.61
7.3.230.0030.01516.56
7.3.210.0170.00616.39
7.3.200.0170.00019.39
7.3.190.0090.01316.32
7.3.180.0100.00716.24
7.3.170.0100.01016.48
7.3.160.0100.00716.40
7.3.120.0040.01214.87
7.2.330.0140.00316.78
7.2.320.0090.01416.74
7.2.310.0130.01216.58
7.2.300.0120.00916.73
7.2.290.0030.01316.60
7.2.00.0060.00919.56
7.1.100.0060.00618.45
7.1.70.0000.00817.26
7.1.60.0070.01719.17
7.1.50.0110.01417.11
7.1.00.0100.06722.45
7.0.200.0050.00216.97
7.0.140.0070.07022.18
7.0.70.0070.06321.71
7.0.60.0030.08721.64
7.0.50.0130.07022.09
7.0.40.0030.06720.14
7.0.30.0030.09020.03
7.0.20.0030.07020.11
7.0.10.0070.08020.04
7.0.00.0100.08320.17
5.6.280.0030.07321.02
5.6.220.0000.06320.57
5.6.210.0000.06020.63
5.6.200.0070.07721.06
5.6.190.0000.09020.95
5.6.180.0000.08721.17
5.6.170.0070.08021.08
5.6.160.0130.07721.05
5.6.150.0030.08321.02
5.6.140.0030.08021.06
5.6.130.0030.06021.01
5.6.120.0100.04320.93
5.6.110.0030.09021.07
5.6.100.0070.04321.01
5.6.90.0130.08021.12
5.6.80.0100.05020.45
5.6.70.0030.08020.39
5.6.60.0100.06020.39
5.6.50.0000.06720.56
5.6.40.0030.04020.47
5.6.30.0070.08020.43
5.6.20.0070.07020.39
5.6.10.0000.08320.52
5.6.00.0030.05320.36
5.5.360.0100.04720.32
5.5.350.0000.08720.41
5.5.340.0070.08720.89
5.5.330.0030.09020.76
5.5.320.0100.07320.79
5.5.310.0030.08720.90
5.5.300.0100.07720.86
5.5.290.0030.08320.73
5.5.280.0000.05320.78
5.5.270.0030.05720.72
5.5.260.0130.07320.88
5.5.250.0000.07020.71
5.5.240.0070.04020.29
5.5.230.0070.05320.26
5.5.220.0070.08320.13
5.5.210.0030.07720.02
5.5.200.0000.07720.09
5.5.190.0100.07720.23
5.5.180.0000.07720.23
5.5.160.0030.05320.13
5.5.150.0000.07720.11
5.5.140.0030.06720.26
5.5.130.0030.07720.17
5.5.120.0000.08020.26
5.5.110.0100.07320.25
5.5.100.0030.07720.18
5.5.90.0000.06319.93
5.5.80.0030.05320.07
5.5.70.0070.07720.12
5.5.60.0130.08320.09
5.5.50.0030.03719.91
5.5.40.0000.07720.14
5.5.30.0030.08320.14
5.5.20.0000.07320.15
5.5.10.0000.08720.02
5.5.00.0030.07320.07
5.4.450.0070.06319.38
5.4.440.0030.05019.45
5.4.430.0100.04019.35
5.4.420.0000.08019.50
5.4.410.0000.08319.26
5.4.400.0070.05019.21
5.4.390.0000.07719.23
5.4.380.0070.06719.21
5.4.370.0000.08019.18
5.4.360.0000.07018.91
5.4.350.0030.03719.11
5.4.340.0070.07319.12
5.4.320.0030.06319.13
5.4.310.0070.07718.85
5.4.300.0030.07319.12
5.4.290.0000.08019.04
5.4.280.0130.07319.04
5.4.270.0100.07319.08
5.4.260.0030.08018.90
5.4.250.0030.05018.84
5.4.240.0070.06719.12
5.4.230.0030.08019.04
5.4.220.0070.04019.23
5.4.210.0130.06718.94
5.4.200.0000.08019.04
5.4.190.0030.05719.11
5.4.180.0030.07019.03
5.4.170.0100.07719.01
5.4.160.0030.07319.01
5.4.150.0030.08319.02
5.4.140.0030.08016.29
5.4.130.0100.07016.38
5.4.120.0000.07316.14
5.4.110.0030.06716.50
5.4.100.0000.07316.45
5.4.90.0070.06716.58
5.4.80.0030.05716.38
5.4.70.0000.04316.38
5.4.60.0030.07716.48
5.4.50.0070.06716.48
5.4.40.0070.06716.35
5.4.30.0030.07016.45
5.4.20.0100.05016.24
5.4.10.0070.07316.40
5.4.00.0000.07715.82
5.3.290.0000.07314.67
5.3.280.0070.07314.71
5.3.270.0030.07714.64
5.3.260.0030.07314.70
5.3.250.0030.07714.72
5.3.240.0030.07314.55
5.3.230.0000.07714.71
5.3.220.0070.04314.60
5.3.210.0030.08014.69
5.3.200.0000.08014.66
5.3.190.0030.07714.55
5.3.180.0000.08014.52
5.3.170.0000.05314.62
5.3.160.0070.06714.53
5.3.150.0030.08014.52
5.3.140.0070.07714.52
5.3.130.0030.07714.59
5.3.120.0070.05314.60
5.3.110.0000.08014.64
5.3.100.0000.07714.00
5.3.90.0000.06713.98
5.3.80.0070.07314.09
5.3.70.0000.07713.95
5.3.60.0030.07714.13
5.3.50.0000.07713.84
5.3.40.0030.06014.04
5.3.30.0100.03013.86
5.3.20.0070.05013.79
5.3.10.0000.07713.75
5.3.00.0000.05313.70
5.2.170.0030.06311.07
5.2.160.0000.05711.16
5.2.150.0030.06011.18
5.2.140.0000.06311.02
5.2.130.0030.06310.99
5.2.120.0000.06711.10
5.2.110.0000.03011.20
5.2.100.0070.04311.10
5.2.90.0070.03311.05
5.2.80.0030.07011.21
5.2.70.0030.06311.11
5.2.60.0030.06311.15
5.2.50.0030.06310.92
5.2.40.0030.05711.01
5.2.30.0030.04010.98
5.2.20.0070.04711.10
5.2.10.0030.04710.93
5.2.00.0030.06010.57
5.1.60.0000.05710.20
5.1.50.0030.05010.20
5.1.40.0030.04710.20
5.1.30.0070.05310.44
5.1.20.0000.05710.40
5.1.10.0030.05710.20
5.1.00.0000.05310.20
5.0.50.0070.04310.20
5.0.40.0000.03310.20
5.0.30.0030.06310.20
5.0.20.0000.04310.20
5.0.10.0030.04310.20
5.0.00.0030.06310.20
4.4.90.0030.03710.20
4.4.80.0030.02310.20
4.4.70.0000.03710.20
4.4.60.0000.03010.20
4.4.50.0000.02310.20
4.4.40.0030.05310.20
4.4.30.0000.03710.20
4.4.20.0000.03710.20
4.4.10.0000.03710.20
4.4.00.0070.05010.20
4.3.110.0000.04010.20
4.3.100.0000.03710.20
4.3.90.0000.03710.20
4.3.80.0000.05010.20
4.3.70.0030.03010.20
4.3.60.0030.03010.20
4.3.50.0000.03010.20
4.3.40.0030.04010.20
4.3.30.0000.04010.20
4.3.20.0070.02710.20
4.3.10.0000.02710.20
4.3.00.0000.03310.20

preferences:
39.13 ms | 401 KiB | 5 Q