3v4l.org

run code in 300+ PHP versions simultaneously
<?php function nums() { $ary = [24,25,26,27,28,29,30,31,32]; foreach ( $ary as $x ) { $cmd = (yield $x); // yield expr if ($cmd != null && $cmd != 'stop') echo $cmd,"\n"; if ($cmd == 'stop') { echo 'Stopped and closed generator',"\n"; return; } } } $gen = nums(); foreach ($gen as $value) { echo "$value\n"; if ($value == 26) $gen->send('reinforcements'); if ($value == 28) { // don't let it past 28 $gen->send('stop'); } }

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.0110.00718.30
8.3.50.0070.00921.27
8.3.40.0070.00718.70
8.3.30.0110.00420.31
8.3.20.0050.00318.60
8.3.10.0040.00421.08
8.3.00.0040.00422.45
8.2.180.0090.01216.38
8.2.170.0040.01122.96
8.2.160.0030.01022.30
8.2.150.0070.00024.18
8.2.140.0030.00524.66
8.2.130.0000.00726.16
8.2.120.0040.00420.92
8.2.110.0040.01422.17
8.2.100.0110.00017.91
8.2.90.0000.00817.91
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0000.00817.80
8.2.50.0050.00318.07
8.2.40.0060.00318.21
8.2.30.0060.00319.36
8.2.20.0000.00717.61
8.2.10.0000.00817.68
8.2.00.0040.00417.84
8.1.280.0070.01325.92
8.1.270.0070.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00320.75
8.1.230.0030.00920.74
8.1.220.0050.00317.79
8.1.210.0040.00419.02
8.1.200.0060.00317.25
8.1.190.0000.00817.51
8.1.180.0030.00518.10
8.1.170.0050.00318.50
8.1.160.0000.00718.75
8.1.150.0060.00318.54
8.1.140.0040.00417.51
8.1.130.0030.00317.82
8.1.120.0000.01117.36
8.1.110.0000.00817.50
8.1.100.0040.00417.41
8.1.90.0030.00617.43
8.1.80.0040.00417.34
8.1.70.0030.00317.42
8.1.60.0000.01017.47
8.1.50.0050.00217.54
8.1.40.0020.00517.52
8.1.30.0040.00417.57
8.1.20.0040.00417.64
8.1.10.0030.00517.41
8.1.00.0000.00717.32
8.0.300.0060.00319.89
8.0.290.0000.00817.05
8.0.280.0070.00018.45
8.0.270.0030.00317.25
8.0.260.0030.00316.73
8.0.250.0050.00316.94
8.0.240.0040.00416.93
8.0.230.0000.00716.96
8.0.220.0040.00416.86
8.0.210.0030.00316.77
8.0.200.0030.00316.88
8.0.190.0070.00016.99
8.0.180.0000.00716.95
8.0.170.0000.00716.80
8.0.160.0000.00716.81
8.0.150.0000.00716.77
8.0.140.0030.00616.81
8.0.130.0030.00313.24
8.0.120.0040.00416.88
8.0.110.0040.00416.88
8.0.100.0000.00716.75
8.0.90.0050.00216.92
8.0.80.0120.00316.87
8.0.70.0050.00316.84
8.0.60.0000.00816.71
8.0.50.0050.00316.98
8.0.30.0080.01017.02
8.0.20.0120.00917.40
8.0.10.0040.00416.86
8.0.00.0150.00316.77
7.4.330.0050.00016.69
7.4.320.0000.00616.61
7.4.300.0060.00016.61
7.4.290.0070.00016.52
7.4.280.0040.00416.57
7.4.270.0000.00716.50
7.4.260.0060.00013.25
7.4.250.0040.00416.53
7.4.240.0030.00316.43
7.4.230.0030.00316.47
7.4.220.0100.01616.62
7.4.210.0090.00816.54
7.4.200.0000.00816.69
7.4.190.0000.00716.55
7.4.160.0110.00416.52
7.4.150.0160.00317.40
7.4.140.0100.00817.86
7.4.130.0140.01316.45
7.4.120.0060.01116.49
7.4.110.0050.01316.54
7.4.100.0150.00316.39
7.4.90.0090.01216.46
7.4.80.0070.01019.39
7.4.70.0030.01316.61
7.4.60.0120.00916.57
7.4.50.0000.00916.37
7.4.40.0040.01122.77
7.4.30.0130.00616.47
7.4.00.0070.00714.96
7.3.330.0020.00213.18
7.3.320.0000.00513.36
7.3.310.0080.00016.18
7.3.300.0030.00316.31
7.3.290.0070.00716.26
7.3.280.0060.01216.39
7.3.270.0170.00017.40
7.3.260.0120.00818.24
7.3.250.0170.00616.31
7.3.240.0110.01116.58
7.3.230.0040.01416.41
7.3.210.0070.01016.61
7.3.200.0100.00616.62
7.3.190.0050.01816.38
7.3.180.0070.01016.41
7.3.170.0060.00916.43
7.3.160.0090.01216.46
7.3.120.0000.01414.54
7.3.10.0100.00316.80
7.3.00.0050.00816.71
7.2.330.0110.00616.74
7.2.320.0100.01016.75
7.2.310.0190.00416.67
7.2.300.0000.01616.83
7.2.290.0030.01516.65
7.2.130.0000.01716.94
7.2.120.0040.01517.03
7.2.110.0070.00616.98
7.2.100.0120.00316.94
7.2.90.0100.00317.16
7.2.80.0120.00316.79
7.2.70.0030.01216.76
7.2.60.0100.00317.00
7.2.50.0040.01116.89
7.2.40.0030.00616.98
7.2.30.0060.00916.68
7.2.20.0040.00717.03
7.2.10.0000.01517.04
7.2.00.0020.01318.28
7.1.250.0040.00815.92
7.1.200.0070.00715.95
7.1.100.0030.00718.28
7.1.70.0000.00817.34
7.1.60.0090.01519.17
7.1.50.0260.01334.90
7.1.00.0030.03322.51
7.0.200.0050.00516.79
7.0.140.0070.07022.04
7.0.70.0070.06721.71
7.0.60.0030.06321.88
7.0.50.0030.04022.01
7.0.40.0000.04720.18
7.0.30.0030.03320.00
7.0.20.0000.04320.13
7.0.10.0030.03320.12
7.0.00.0030.06020.04
5.6.280.0130.06321.10
5.6.220.0070.03720.62
5.6.210.0030.06020.75
5.6.200.0000.04321.11
5.6.190.0070.03721.05
5.6.180.0070.03021.00
5.6.170.0000.05321.08
5.6.160.0000.05021.08
5.6.150.0070.06721.02
5.6.140.0000.04320.96
5.6.130.0100.08020.98
5.6.120.0030.03721.01
5.6.110.0070.08021.02
5.6.100.0030.06021.07
5.6.90.0070.03021.15
5.6.80.0030.07020.30
5.6.70.0070.03720.48
5.6.60.0030.03020.38
5.6.50.0000.03320.41
5.6.40.0000.04720.39
5.6.30.0030.05020.34
5.6.20.0070.03320.46
5.6.10.0070.03020.46
5.6.00.0030.03020.42
5.5.360.0030.04020.48
5.5.350.0100.05020.40
5.5.340.0030.04020.74
5.5.330.0130.04020.84
5.5.320.0000.08320.86
5.5.310.0030.04720.91
5.5.300.0000.05320.76
5.5.290.0030.04020.91
5.5.280.0000.04320.83
5.5.270.0000.05720.88
5.5.260.0000.04320.86
5.5.250.0030.03320.57
5.5.240.0030.03020.27
5.5.230.0030.05720.02
5.5.220.0070.03320.30
5.5.210.0000.03720.01
5.5.200.0070.03320.09
5.5.190.0000.04020.27
5.5.180.0000.03320.24
5.5.160.0000.03320.14
5.5.150.0030.03720.08
5.5.140.0000.04320.11
5.5.130.0030.04020.20
5.5.120.0000.04320.18
5.5.110.0000.06720.27
5.5.100.0000.04020.10
5.5.90.0000.04020.14
5.5.80.0030.04019.97
5.5.70.0070.04020.08
5.5.60.0100.07320.15
5.5.50.0030.05020.09
5.5.40.0030.05720.06
5.5.30.0100.07320.14
5.5.20.0100.07720.07
5.5.10.0000.07720.00
5.5.00.0070.04319.96
5.4.450.0030.05319.45
5.4.440.0000.03719.36
5.4.430.0030.04019.20
5.4.420.0000.04019.35
5.4.410.0070.03319.25
5.4.400.0000.04019.15
5.4.390.0000.04019.13
5.4.380.0070.02719.13
5.4.370.0030.04319.13
5.4.360.0030.03719.04
5.4.350.0070.05719.21
5.4.340.0030.03719.18
5.4.320.0000.03319.21
5.4.310.0000.04019.13
5.4.300.0030.03319.16
5.4.290.0030.03718.87
5.4.280.0000.06719.23
5.4.270.0000.06719.13
5.4.260.0030.04018.95
5.4.250.0030.03318.85
5.4.240.0030.07319.04
5.4.230.0030.05318.94
5.4.220.0070.07319.13
5.4.210.0030.05319.02
5.4.200.0070.05718.94
5.4.190.0000.08018.84
5.4.180.0070.06718.83
5.4.170.0030.05018.86
5.4.160.0000.05018.93
5.4.150.0030.08319.21
5.4.140.0030.08016.46
5.4.130.0070.07016.34
5.4.120.0030.04316.42
5.4.110.0030.05016.43
5.4.100.0030.07016.50
5.4.90.0100.06016.50
5.4.80.0070.06716.38
5.4.70.0070.07316.25
5.4.60.0030.07316.41
5.4.50.0030.06016.45
5.4.40.0000.08016.45
5.4.30.0070.05316.31
5.4.20.0100.05016.46
5.4.10.0030.05016.44
5.4.00.0030.04015.87
5.3.290.0030.05315.84
5.3.280.0030.05015.84
5.3.270.0100.05015.84
5.3.260.0030.04315.84
5.3.250.0000.07315.84
5.3.240.0070.04715.84
5.3.230.0030.05015.84
5.3.220.0000.07715.84
5.3.210.0030.06015.84
5.3.200.0130.03315.84
5.3.190.0000.04015.84
5.3.180.0000.08015.84
5.3.170.0070.06315.84
5.3.160.0030.07315.84
5.3.150.0070.05015.84
5.3.140.0030.07715.84
5.3.130.0030.08315.84
5.3.120.0030.07315.84
5.3.110.0030.07715.84
5.3.100.0000.08015.84
5.3.90.0000.07315.84
5.3.80.0100.07015.84
5.3.70.0030.05715.84
5.3.60.0070.07315.84
5.3.50.0000.05315.84
5.3.40.0000.08015.84
5.3.30.0070.05715.84
5.3.20.0030.07715.84
5.3.10.0070.06315.84
5.3.00.0070.07015.84
5.2.170.0100.06015.84
5.2.160.0000.06315.84
5.2.150.0000.06015.84
5.2.140.0100.05715.84
5.2.130.0070.04315.84
5.2.120.0070.03715.84
5.2.110.0030.05715.84
5.2.100.0000.06315.84
5.2.90.0000.05315.84
5.2.80.0000.05015.84
5.2.70.0070.05315.84
5.2.60.0030.06015.84
5.2.50.0030.06015.84
5.2.40.0000.06315.84
5.2.30.0000.04315.84
5.2.20.0030.05715.84
5.2.10.0000.06015.84
5.2.00.0030.04315.84
5.1.60.0030.05315.84
5.1.50.0070.03315.84
5.1.40.0030.05315.84
5.1.30.0070.04715.84
5.1.20.0070.05715.84
5.1.10.0070.04715.84
5.1.00.0000.04715.84
5.0.50.0030.03715.84
5.0.40.0070.04315.84
5.0.30.0030.05015.84
5.0.20.0100.03315.84
5.0.10.0070.04015.84
5.0.00.0000.07015.84
4.4.90.0100.02715.84
4.4.80.0000.03715.84
4.4.70.0000.03015.84
4.4.60.0000.03315.84
4.4.50.0030.03315.84
4.4.40.0000.05715.84
4.4.30.0100.02715.84
4.4.20.0000.03015.84
4.4.10.0070.03015.84
4.4.00.0000.04015.84
4.3.110.0030.03315.84
4.3.100.0100.02715.84
4.3.90.0000.03715.84
4.3.80.0070.05715.84
4.3.70.0070.03015.84
4.3.60.0000.03015.84
4.3.50.0000.03315.84
4.3.40.0000.04315.84
4.3.30.0030.03015.84
4.3.20.0070.01715.84
4.3.10.0030.03315.84
4.3.00.0030.03015.84

preferences:
36.98 ms | 400 KiB | 5 Q