3v4l.org

run code in 300+ PHP versions simultaneously
<?php function nums() { $ary = [24,25,26,27,28,29,30,31,32]; for($x = 0,$times=0, $max = count($ary); $x < $max; $x += 2,$times++) { $cmd = (yield $ary[$x]); // yield expr var_dump($cmd,$times); if ($cmd == 'stop') { echo 'Stopping the generator ...',"\n"; return; } } echo "Generator ran its course and is closed","\n"; return; } $gen = nums(); foreach ($gen as $value) { echo "$value\n"; if ($value == 28) { // don't let it get to 32 $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.0150.00018.55
8.3.50.0060.01321.14
8.3.40.0120.00318.81
8.3.30.0090.00620.33
8.3.20.0090.00618.73
8.3.10.0040.00421.08
8.3.00.0040.00422.44
8.2.180.0140.00716.50
8.2.170.0110.00722.96
8.2.160.0030.01220.44
8.2.150.0030.00524.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00421.11
8.2.110.0090.00019.23
8.2.100.0150.00017.87
8.2.90.0000.00719.21
8.2.80.0040.00418.05
8.2.70.0040.00417.63
8.2.60.0030.00517.93
8.2.50.0000.00818.07
8.2.40.0040.00418.34
8.2.30.0040.00419.32
8.2.20.0000.00817.74
8.2.10.0040.00417.73
8.2.00.0040.00417.67
8.1.280.0080.00825.92
8.1.270.0000.00823.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0090.00023.99
8.1.230.0110.00020.86
8.1.220.0050.00318.77
8.1.210.0000.00719.08
8.1.200.0000.01017.35
8.1.190.0030.00617.63
8.1.180.0050.00318.10
8.1.170.0040.00418.53
8.1.160.0080.00018.89
8.1.150.0000.00818.68
8.1.140.0050.00217.43
8.1.130.0030.00317.78
8.1.120.0060.00317.47
8.1.110.0000.00717.48
8.1.100.0000.00717.30
8.1.90.0030.00317.44
8.1.80.0080.00017.48
8.1.70.0030.00317.40
8.1.60.0000.00817.57
8.1.50.0040.00417.38
8.1.40.0030.00517.40
8.1.30.0040.00417.48
8.1.20.0060.00317.55
8.1.10.0000.00817.48
8.1.00.0000.00817.54
8.0.300.0030.00619.97
8.0.290.0040.00417.04
8.0.280.0030.00318.30
8.0.270.0020.00517.14
8.0.260.0000.00616.70
8.0.250.0000.00716.93
8.0.240.0000.00916.93
8.0.230.0070.00016.91
8.0.220.0000.00716.92
8.0.210.0050.00316.82
8.0.200.0070.00016.90
8.0.190.0030.00616.96
8.0.180.0030.00516.89
8.0.170.0050.00316.89
8.0.160.0040.00416.91
8.0.150.0040.00416.80
8.0.140.0040.00416.85
8.0.130.0030.00313.29
8.0.120.0000.00816.80
8.0.110.0000.00716.80
8.0.100.0040.00416.86
8.0.90.0000.00716.94
8.0.80.0060.01516.79
8.0.70.0040.00416.76
8.0.60.0040.00416.91
8.0.50.0030.00516.75
8.0.30.0080.01016.99
8.0.20.0110.00717.40
8.0.10.0000.00716.90
8.0.00.0100.01016.75
7.4.330.0030.00316.73
7.4.320.0030.00316.57
7.4.300.0060.00016.52
7.4.290.0000.00716.46
7.4.280.0040.00416.46
7.4.270.0030.00316.49
7.4.260.0000.00513.20
7.4.250.0040.00416.37
7.4.240.0070.00016.59
7.4.230.0070.00016.58
7.4.220.0130.01316.59
7.4.210.0120.00516.46
7.4.200.0030.00316.60
7.4.190.0090.00016.57
7.4.160.0090.00916.54
7.4.150.0080.01117.40
7.4.140.0080.01017.86
7.4.130.0110.00616.40
7.4.120.0050.01216.43
7.4.110.0090.00916.45
7.4.100.0150.00416.48
7.4.90.0090.00916.50
7.4.80.0060.01119.39
7.4.70.0140.00816.57
7.4.60.0070.01016.39
7.4.50.0080.00016.58
7.4.40.0120.00622.77
7.4.30.0060.01016.52
7.4.00.0070.01115.06
7.3.330.0050.00013.30
7.3.320.0000.00613.39
7.3.310.0060.00316.30
7.3.300.0000.00716.33
7.3.290.0030.01316.25
7.3.280.0070.01016.30
7.3.270.0100.00617.40
7.3.260.0100.00818.24
7.3.250.0070.01116.51
7.3.240.0090.00916.40
7.3.230.0100.00616.50
7.3.210.0060.01216.48
7.3.200.0060.01619.39
7.3.190.0070.01016.35
7.3.180.0080.00816.47
7.3.170.0040.01116.64
7.3.160.0060.00916.32
7.3.120.0070.01014.84
7.3.10.0030.00616.57
7.3.00.0070.00016.41
7.2.330.0100.00816.53
7.2.320.0090.01316.88
7.2.310.0060.01216.79
7.2.300.0100.00716.61
7.2.290.0070.01416.82
7.2.130.0040.00716.93
7.2.120.0040.01216.70
7.2.110.0100.00716.71
7.2.100.0080.00816.88
7.2.90.0120.00816.68
7.2.80.0110.00716.90
7.2.70.0110.00816.91
7.2.60.0100.00517.02
7.2.50.0040.00816.71
7.2.40.0130.00516.92
7.2.30.0070.00717.05
7.2.20.0140.00416.92
7.2.10.0080.00816.87
7.2.00.0030.01318.08
7.1.250.0040.00815.56
7.1.100.0080.00317.78
7.1.70.0000.01017.32
7.1.60.0120.00619.17
7.1.50.0270.00734.71
7.1.00.0000.03722.43
7.0.200.0000.01016.89
7.0.140.0030.07322.18
7.0.110.0030.04020.07
7.0.100.0100.07719.90
7.0.90.0000.09019.85
7.0.80.0000.08319.94
7.0.70.0100.08019.85
7.0.60.0130.08019.96
7.0.50.0100.08019.96
7.0.40.0030.04019.72
7.0.30.0100.07719.75
7.0.20.0130.07319.77
7.0.10.0030.07319.86
7.0.00.0070.07319.73
5.6.280.0030.07320.93
5.6.260.0100.06320.68
5.6.250.0100.03720.73
5.6.240.0130.07320.53
5.6.230.0030.09320.64
5.6.220.0030.06020.55
5.6.210.0000.05020.66
5.6.200.0030.07320.48
5.6.190.0030.04720.86
5.6.180.0000.08020.62
5.6.170.0030.08020.57
5.6.160.0070.08020.47
5.6.150.0100.08020.66
5.6.140.0100.03320.55
5.6.130.0000.04020.64
5.6.120.0070.08020.58
5.6.110.0030.04320.68
5.6.100.0030.03720.84
5.6.90.0070.03720.61
5.6.80.0030.07020.07
5.6.70.0030.07020.07
5.6.60.0130.06719.97
5.6.50.0030.07719.94
5.6.40.0100.03319.92
5.6.30.0070.05020.00
5.6.20.0070.04019.91
5.6.10.0100.07719.91
5.6.00.0030.04719.92
5.5.380.0070.05317.60
5.5.370.0100.03017.53
5.5.360.0000.04317.62
5.5.350.0030.07317.25
5.5.340.0070.03718.13
5.5.330.0030.06318.09
5.5.320.0100.03317.91
5.5.310.0100.06718.13
5.5.300.0030.08317.83
5.5.290.0030.08717.91
5.5.280.0070.06717.91
5.5.270.0000.04718.09
5.5.260.0030.03718.09
5.5.250.0130.05017.74
5.5.240.0030.03717.64
5.5.230.0030.03717.51
5.5.220.0030.06017.29
5.5.210.0130.06717.46
5.5.200.0000.03717.58
5.5.190.0030.04017.19
5.5.180.0030.03317.32
5.5.160.0170.07317.14
5.5.150.0030.03317.57
5.5.140.0100.02717.48
5.5.130.0130.03017.27
5.5.120.0130.02717.26
5.5.110.0170.07317.27
5.5.100.0030.05317.32
5.5.90.0070.04717.39
5.5.80.0000.03717.21
5.5.70.0170.07017.47
5.5.60.0070.03017.15
5.5.50.0000.03717.35
5.5.40.0000.04317.15
5.5.30.0000.03717.46
5.5.20.0000.07317.14
5.5.10.0000.06317.31
5.5.00.0030.04717.15
5.4.450.0030.07319.67
5.4.440.0030.04319.57
5.4.430.0070.03019.56
5.4.420.0100.04019.32
5.4.410.0070.05319.53
5.4.400.0100.04719.00
5.4.390.0070.06719.23
5.4.380.0070.07719.04
5.4.370.0000.06719.18
5.4.360.0070.03019.02
5.4.350.0130.06719.37
5.4.340.0070.07719.05
5.4.320.0070.05019.02
5.4.310.0070.03019.24
5.4.300.0000.08019.24
5.4.290.0000.08019.18
5.4.280.0000.03718.93
5.4.270.0100.06319.33
5.4.260.0100.07319.00
5.4.250.0030.05719.33
5.4.240.0030.06319.00
5.4.230.0000.03719.00
5.4.220.0170.06719.24
5.4.210.0070.03018.99
5.4.200.0030.07718.97
5.4.190.0000.06018.99
5.4.180.0100.07319.00
5.4.170.0000.04019.33
5.4.160.0030.03319.01
5.4.150.0030.06719.16
5.4.140.0070.05716.32
5.4.130.0070.05716.29
5.4.120.0030.03016.43
5.4.110.0030.07316.47
5.4.100.0070.05716.47
5.4.90.0030.03316.50
5.4.80.0100.03316.30
5.4.70.0000.05316.54
5.4.60.0030.07016.55
5.4.50.0000.07316.29
5.4.40.0000.07016.43
5.4.30.0130.02316.55
5.4.20.0070.06016.48
5.4.10.0070.04716.23
5.4.00.0100.02315.80
5.3.290.0070.03014.68
5.3.280.0030.07714.62
5.3.270.0030.04714.46
5.3.260.0000.03714.59
5.3.250.0030.03314.73
5.3.240.0070.03014.61
5.3.230.0070.06314.73
5.3.220.0000.07014.59
5.3.210.0070.06714.80
5.3.200.0030.04714.80
5.3.190.0070.03314.58
5.3.180.0030.03714.71
5.3.170.0030.07314.54
5.3.160.0070.06714.43
5.3.150.0030.04014.70
5.3.140.0030.03314.64
5.3.130.0070.05314.57
5.3.120.0100.06314.56
5.3.110.0130.06714.67
5.3.100.0030.06314.13
5.3.90.0030.03314.02
5.3.80.0000.04014.24
5.3.70.0100.05714.05
5.3.60.0030.06313.97
5.3.50.0000.03713.96
5.3.40.0000.07314.03
5.3.30.0000.07014.03
5.3.20.0100.03013.91
5.3.10.0130.06313.71
5.3.00.0000.07013.70
5.2.170.0000.02711.76
5.2.160.0030.05711.76
5.2.150.0030.06011.76
5.2.140.0100.06011.76
5.2.130.0030.06311.76
5.2.120.0000.04311.76
5.2.110.0000.06011.76
5.2.100.0030.03711.76
5.2.90.0000.06311.76
5.2.80.0030.06311.76
5.2.70.0100.04711.76
5.2.60.0030.03011.76
5.2.50.0070.04011.76
5.2.40.0000.02711.76
5.2.30.0000.04711.76
5.2.20.0000.03011.76
5.2.10.0030.02711.76
5.2.00.0000.04011.76
5.1.60.0000.02711.76
5.1.50.0030.02311.76
5.1.40.0000.04311.76
5.1.30.0000.02311.76
5.1.20.0030.05311.76
5.1.10.0000.03011.76
5.1.00.0000.03011.76
5.0.50.0030.02011.76
5.0.40.0000.02011.76
5.0.30.0030.04711.76
5.0.20.0000.01711.76
5.0.10.0000.03711.76
5.0.00.0000.02711.76
4.4.90.0000.01711.76
4.4.80.0000.01711.76
4.4.70.0070.02311.76
4.4.60.0030.01311.76
4.4.50.0000.03711.76
4.4.40.0030.02711.76
4.4.30.0030.02311.76
4.4.20.0030.03011.76
4.4.10.0000.01311.76
4.4.00.0000.04011.76
4.3.110.0000.01311.76
4.3.100.0030.03011.76
4.3.90.0000.01311.76
4.3.80.0070.03711.76
4.3.70.0070.02011.76
4.3.60.0000.01711.76
4.3.50.0000.03011.76
4.3.40.0070.01311.76
4.3.30.0030.01011.76
4.3.20.0000.01311.76
4.3.10.0000.01311.76
4.3.00.0000.01311.76

preferences:
38.31 ms | 401 KiB | 5 Q