3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen1() { yield 1; yield 2; } /** function yieldFrom() { $iter = gen1(); foreach($iter as $val) { yield $val; } } /**/ /**/ function gen2() { yield from gen1(); } /**/ $g = gen2(); foreach($g as $val) { var_dump($val); }

Here you find the average performance (time & memory) of each version. A greyed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0090.00319.46
7.1.100.0060.00618.24
7.1.70.0070.01016.97
7.1.60.0110.01419.50
7.1.50.0070.01416.92
7.1.00.0000.08022.46
7.0.200.0000.00816.47
7.0.60.0030.04719.86
7.0.50.0100.07717.86
7.0.40.0030.07720.24
7.0.30.0530.06720.23
7.0.20.0270.07320.23
7.0.10.0200.08020.12
7.0.00.0130.07720.29
5.6.280.0030.03020.93
5.6.210.0100.08020.65
5.6.200.0030.04718.26
5.6.190.0130.06020.47
5.6.180.0170.04720.59
5.6.170.0300.06320.40
5.6.160.0070.09020.55
5.6.150.0070.04718.19
5.6.140.0030.06018.24
5.6.130.0000.04318.15
5.6.120.0070.05021.10
5.6.110.0200.07321.14
5.6.100.0070.07021.11
5.6.90.0070.05320.98
5.6.80.0070.05720.54
5.6.70.0230.07020.41
5.5.350.0230.06020.43
5.5.340.0000.04718.01
5.5.330.0070.08320.08
5.5.320.0030.05320.34
5.5.310.0300.07320.38
5.5.300.0130.07718.04
5.5.290.0130.07317.95
5.5.280.0070.08320.80
5.5.270.0170.07320.77
5.5.260.0100.07720.96
5.5.250.0130.07320.66
5.5.240.0070.06020.16
5.4.450.0800.05319.43
5.4.440.0770.05719.28
5.4.430.0670.05019.46
5.4.420.0630.05319.42
5.4.410.0600.05319.17
5.4.400.0570.04018.94
5.4.390.0470.05319.20
5.4.380.0430.05319.28
5.4.370.0470.04718.80
5.4.360.0530.04719.29
5.4.350.0530.04319.03
5.4.340.0530.04319.12
5.4.320.0370.06019.17
5.4.310.0170.04719.11
5.4.300.0100.05319.10
5.4.290.0270.04319.29
5.4.280.0100.06018.82
5.4.270.0070.06319.27
5.4.260.0070.05719.37
5.4.250.0170.04319.36
5.4.240.0070.05719.02
5.4.230.0200.04319.27
5.4.220.0470.06719.11
5.4.210.0470.05319.38
5.4.200.0570.05019.12
5.4.190.0470.06719.29
5.4.180.0630.03318.98
5.4.170.0430.05319.27
5.4.160.0500.04719.25
5.4.150.0500.05719.23
5.4.140.0470.05016.26
5.4.130.0730.05316.21
5.4.120.0670.04316.46
5.4.110.0630.05016.60
5.4.100.0600.04316.43
5.4.90.0830.04016.61
5.4.80.0570.04716.48
5.4.70.0530.05316.40
5.4.60.0630.04316.20
5.4.50.0670.04716.57
5.4.40.0230.04316.23
5.4.30.0130.04716.48
5.4.20.0000.05716.59
5.4.10.0100.05716.50
5.4.00.0130.04315.75
5.3.290.0800.04714.68
5.3.280.0670.06014.60
5.3.270.0700.04314.83
5.3.260.0130.05014.63
5.3.250.0000.06014.61
5.3.240.0400.04714.66
5.3.230.0670.06014.62
5.3.220.0730.04314.58
5.3.210.0670.05014.58
5.3.200.0600.04714.57
5.3.190.0670.05014.62