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 == 3) { $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.0030.01016.75
8.3.50.0090.00917.32
8.3.40.0110.00418.80
8.3.30.0150.00018.72
8.3.20.0090.00018.63
8.3.10.0080.00020.49
8.3.00.0040.00419.13
8.2.180.0090.00916.50
8.2.170.0150.00022.96
8.2.160.0120.00320.87
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0100.00017.50
8.2.110.0050.00521.00
8.2.100.0080.00317.78
8.2.90.0030.00620.77
8.2.80.0080.00018.03
8.2.70.0030.00617.63
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0080.00018.16
8.2.30.0040.00418.05
8.2.20.0030.00617.59
8.2.10.0040.00417.68
8.2.00.0030.00517.75
8.1.280.0150.00025.92
8.1.270.0000.00824.66
8.1.260.0000.00826.35
8.1.250.0050.00228.09
8.1.240.0000.00922.44
8.1.230.0080.00420.87
8.1.220.0040.00417.78
8.1.210.0060.00318.86
8.1.200.0110.00017.35
8.1.190.0060.00317.66
8.1.180.0050.00318.10
8.1.170.0080.00018.77
8.1.160.0080.00018.95
8.1.150.0000.00818.60
8.1.140.0040.00417.38
8.1.130.0000.00717.89
8.1.120.0050.00217.38
8.1.110.0040.00417.47
8.1.100.0050.00317.45
8.1.90.0030.00617.42
8.1.80.0040.00417.39
8.1.70.0000.00717.43
8.1.60.0030.00717.58
8.1.50.0030.00517.47
8.1.40.0040.00417.43
8.1.30.0000.00717.48
8.1.20.0030.00617.63
8.1.10.0000.00817.47
8.1.00.0000.00817.45
8.0.300.0000.00720.03
8.0.290.0040.00416.75
8.0.280.0080.00018.38
8.0.270.0030.00317.32
8.0.260.0000.00616.89
8.0.250.0000.00816.95
8.0.240.0000.00716.84
8.0.230.0000.00716.95
8.0.220.0030.00316.86
8.0.210.0030.00316.92
8.0.200.0030.00316.98
8.0.190.0030.00516.97
8.0.180.0000.00716.88
8.0.170.0000.00816.79
8.0.160.0030.00316.93
8.0.150.0030.00616.85
8.0.140.0000.00716.89
8.0.130.0060.00013.26
8.0.120.0040.00416.82
8.0.110.0000.00816.71
8.0.100.0030.00516.77
8.0.90.0070.00016.92
8.0.80.0040.01116.89
8.0.70.0050.00316.96
8.0.60.0040.00416.72
8.0.50.0050.00216.89
8.0.30.0120.00617.13
8.0.20.0140.00717.23
8.0.10.0070.00017.02
8.0.00.0160.00316.93
7.4.330.0000.00513.05
7.4.320.0000.00616.53
7.4.300.0000.00716.53
7.4.290.0030.00316.52
7.4.280.0080.00016.56
7.4.270.0050.00216.57
7.4.260.0050.00013.32
7.4.250.0000.00816.55
7.4.240.0070.00016.60
7.4.230.0000.00716.61
7.4.220.0160.01316.56
7.4.210.0070.00816.54
7.4.200.0050.00316.68
7.4.190.0000.00816.50
7.4.160.0130.00316.46
7.4.150.0100.00716.62
7.4.140.0100.00816.46
7.4.130.0140.00516.45
7.4.120.0090.00816.53
7.4.110.0070.01016.52
7.4.100.0130.00316.48
7.4.90.0130.00716.55
7.4.80.0060.01219.39
7.4.70.0100.00616.54
7.4.60.0070.01016.44
7.4.50.0000.00416.35
7.4.40.0060.00316.37
7.4.30.0080.00816.55
7.4.00.0000.01614.71
7.3.330.0030.00313.36
7.3.320.0000.00613.24
7.3.310.0030.00516.23
7.3.300.0030.00316.29
7.3.290.0070.00716.26
7.3.280.0070.00916.36
7.3.270.0120.00916.40
7.3.260.0150.00316.68
7.3.250.0100.01016.45
7.3.240.0040.01216.57
7.3.230.0030.01316.60
7.3.210.0060.01016.39
7.3.200.0100.00716.68
7.3.190.0060.01316.47
7.3.180.0120.00616.38
7.3.170.0140.00616.49
7.3.160.0140.00316.37
7.3.120.0070.00714.83
7.2.330.0060.01516.74
7.2.320.0080.00816.42
7.2.310.0100.01716.91
7.2.300.0070.01116.76
7.2.290.0100.00716.78
7.2.00.0040.01118.98
7.1.100.0000.01118.25
7.1.70.0040.00417.00
7.1.60.0060.01919.40
7.1.50.0000.02416.99
7.1.00.0130.05322.32
7.0.200.1130.01014.80
7.0.140.0030.07322.08
7.0.120.0030.07322.04
7.0.60.0130.07719.87
7.0.50.0070.07717.88
7.0.40.0170.07017.75
7.0.30.0070.04317.76
7.0.20.0130.07317.75
7.0.10.0030.05717.84
7.0.00.0100.08317.75
5.6.280.0030.07321.04
5.6.210.0030.07720.48
5.6.200.0100.05318.16
5.6.190.0270.06318.14
5.6.180.0000.08318.29
5.6.170.0000.09018.19
5.6.160.0070.07718.18
5.6.150.0100.07718.11
5.6.140.0030.04318.18
5.6.130.0030.04318.18
5.6.120.0100.08318.15
5.6.110.0100.04318.13
5.6.100.0030.08718.27
5.6.90.0170.07718.16
5.6.80.0070.05317.56
5.6.70.0070.05017.50
5.6.60.0000.05017.60
5.6.50.0100.04017.54
5.6.40.0030.07317.54
5.6.30.0100.07317.52
5.6.20.0130.07017.51
5.6.10.0130.07317.50
5.6.00.0070.08017.58
5.5.350.0400.06320.40
5.5.340.0070.05717.92
5.5.330.0030.07017.98
5.5.320.0130.05017.95
5.5.310.0070.08017.98
5.5.300.0070.03717.98
5.5.290.0070.06017.99
5.5.280.0030.04317.95
5.5.270.0070.06318.07
5.5.260.0070.04018.02
5.5.250.0100.07717.77
5.5.240.0030.05317.34
5.5.230.0070.03717.43
5.5.220.0070.03717.41
5.5.210.0070.07717.36
5.5.200.0070.07717.33
5.5.190.0170.06717.40
5.5.180.0070.04717.28
5.5.160.0130.07317.37
5.5.150.0030.06717.34
5.5.140.0000.05317.29
5.5.130.0000.04017.43
5.5.120.0070.03717.30
5.5.110.0030.03717.42
5.5.100.0000.04017.21
5.5.90.0100.03017.24
5.5.80.0030.03717.32
5.5.70.0100.03017.16
5.5.60.0070.04017.23
5.5.50.0000.04017.23
5.5.40.0030.03717.23
5.5.30.0030.03717.28
5.5.20.0030.03717.32
5.5.10.0100.03017.28
5.5.00.0000.04017.25
5.4.450.0070.08019.32
5.4.440.0070.03719.36
5.4.430.0070.06319.35
5.4.420.0070.05019.27
5.4.410.0070.07719.22
5.4.400.0070.04319.05
5.4.390.0100.04719.13
5.4.380.0130.04719.05
5.4.370.0070.03719.03
5.4.360.0030.05319.05
5.4.350.0030.08319.06
5.4.340.0070.07718.98
5.4.320.0100.04719.13
5.4.310.0070.07319.14
5.4.300.0100.03718.88
5.4.290.0000.04019.13
5.4.280.0000.04019.04
5.4.270.0030.03719.03
5.4.260.0000.04019.01
5.4.250.0030.04019.09
5.4.240.0070.03318.97
5.4.230.0070.04719.11
5.4.220.0070.03318.88
5.4.210.0070.03319.11
5.4.200.0030.04019.04
5.4.190.0000.04019.00
5.4.180.0000.04019.04
5.4.170.0070.03319.00
5.4.160.0030.03718.99
5.4.150.0070.03319.03
5.4.140.0000.03716.57
5.4.130.0030.03316.40
5.4.120.0030.03316.34
5.4.110.0000.04316.38
5.4.100.0070.03016.45
5.4.90.0070.03316.29
5.4.80.0030.03316.54
5.4.70.0070.03016.46
5.4.60.0030.03316.37
5.4.50.0000.03716.53
5.4.40.0070.03016.47
5.4.30.0030.03316.35
5.4.20.0030.05716.26
5.4.10.0070.04316.34
5.4.00.0130.06315.89
5.3.290.0070.04014.65
5.3.280.0030.03714.66
5.3.270.0000.04014.64
5.3.260.0000.06714.64
5.3.250.0030.03314.82
5.3.240.0070.03314.59
5.3.230.0000.04014.67
5.3.220.0030.04014.53
5.3.210.0000.04314.63
5.3.200.0000.03714.61
5.3.190.0070.03314.52
5.3.180.0030.03314.60
5.3.170.0070.04714.59
5.3.160.0000.03714.62
5.3.150.0030.03714.41
5.3.140.0030.03314.54
5.3.130.0070.03314.75
5.3.120.0070.05714.54
5.3.110.0030.05714.75
5.3.100.0070.06014.24
5.3.90.0000.04314.24
5.3.80.0000.05314.24
5.3.70.0070.03714.02
5.3.60.0030.05314.01
5.3.50.0070.04314.01
5.3.40.0030.06713.98
5.3.30.0070.03713.92
5.3.20.0070.03313.75
5.3.10.0030.07313.85
5.3.00.0000.04313.66
5.2.170.0030.03011.16
5.2.160.0030.03711.18
5.2.150.0070.03311.19
5.2.140.0030.03711.16
5.2.130.0070.03011.00
5.2.120.0100.05711.09
5.2.110.0070.03311.17
5.2.100.0030.04011.13
5.2.90.0030.05311.06
5.2.80.0030.06011.11
5.2.70.0000.06011.11
5.2.60.0000.04710.89
5.2.50.0130.04310.98
5.2.40.0070.04011.05
5.2.30.0100.06011.07
5.2.20.0100.04311.01
5.2.10.0030.05710.86
5.2.00.0070.05710.56
5.1.60.0070.04010.05
5.1.50.0030.05310.07
5.1.40.0030.0509.80
5.1.30.0030.04710.32
5.1.20.0100.05310.39
5.1.10.0000.04710.00
5.1.00.0000.04010.13
5.0.50.0030.0208.55
5.0.40.0030.0378.48
5.0.30.0100.0578.25
5.0.20.0070.0438.16
5.0.10.0030.0408.09
5.0.00.0030.0678.08
4.4.90.0030.0377.44
4.4.80.0030.0277.44
4.4.70.0030.0377.44
4.4.60.0030.0307.44
4.4.50.0000.0377.44
4.4.40.0030.0537.44
4.4.30.0030.0177.44
4.4.20.0000.0407.44
4.4.10.0000.0177.44
4.4.00.0030.0477.44
4.3.110.0070.0337.44
4.3.100.0030.0307.44
4.3.90.0030.0277.44
4.3.80.0000.0577.44
4.3.70.0070.0237.44
4.3.60.0070.0237.44
4.3.50.0000.0377.44
4.3.40.0030.0437.44
4.3.30.0070.0277.44
4.3.20.0000.0407.44
4.3.10.0000.0407.44
4.3.00.0030.0337.44

preferences:
58.57 ms | 400 KiB | 5 Q