3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { $x = yield 1; echo "Sup!\n"; $y = yield 2; var_dump($x + $y); } function yfgenerator() { yield from gen1(); echo "Dawg\n"; yield from gen1(); yield from [1, 2, 3]; } function yfeiterator() { $arr = [1, 2, 3]; foreach($arr as $val) { yield $val; } } function yfiterator() { yield from []; yield from [1, 2, 3]; /**/ yield from array( "first" => 1, "second" => 2, "third" => 3, ); /**/ } function iterationTest($g) { echo "About to start iteration\n"; foreach($g as $key => $val) { echo "Iteration!\n"; var_dump($key); var_dump($val); } echo "Done with iteration\n"; } function sendingTest($g) { $g->next(); $g->send(10); $g->send(20); } iterationTest(yfiterator()); //iterationTest(yfeiterator()); // iterationTest(gen1()); echo "Done with all tests\n";

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.40.0000.01418.42
8.3.30.0110.00418.72
8.3.20.0040.00420.06
8.3.10.0040.00423.65
8.3.00.0070.00317.50
8.2.170.0100.00722.96
8.2.160.0150.00620.38
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0030.00517.63
8.2.110.0070.00422.30
8.2.100.0060.00617.93
8.2.90.0050.00319.21
8.2.80.0040.00417.97
8.2.70.0050.00317.63
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0000.00821.01
8.2.30.0000.00820.54
8.2.20.0000.00817.57
8.2.10.0050.00218.13
8.2.00.0040.00417.98
8.1.270.0040.00423.95
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00622.56
8.1.230.0080.00417.76
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0040.00417.23
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00420.31
8.1.160.0040.00422.02
8.1.150.0000.00718.77
8.1.140.0000.00819.71
8.1.130.0040.00417.77
8.1.120.0040.00417.46
8.1.110.0030.00517.32
8.1.100.0020.00517.40
8.1.90.0000.00717.35
8.1.80.0000.00817.34
8.1.70.0070.00017.36
8.1.60.0080.00017.57
8.1.50.0090.00017.46
8.1.40.0000.00817.56
8.1.30.0030.00617.64
8.1.20.0000.00817.68
8.1.10.0050.00317.46
8.1.00.0040.00417.34
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0030.00318.45
8.0.270.0050.00317.14
8.0.260.0050.00317.14
8.0.250.0040.00416.96
8.0.240.0080.00016.82
8.0.230.0030.00416.96
8.0.220.0000.00716.79
8.0.210.0070.00016.77
8.0.200.0000.00616.97
8.0.190.0030.00617.00
8.0.180.0070.00016.89
8.0.170.0040.00416.84
8.0.160.0000.00716.86
8.0.150.0030.00516.88
8.0.140.0070.00016.88
8.0.130.0000.00713.37
8.0.120.0030.00516.79
8.0.110.0030.00516.86
8.0.100.0000.00717.01
8.0.90.0000.00716.78
8.0.80.0060.01016.92
8.0.70.0000.00816.96
8.0.60.0000.00816.78
8.0.50.0040.00416.91
8.0.30.0070.01116.96
8.0.20.0100.00917.40
8.0.10.0030.00517.04
8.0.00.0130.00716.78
7.4.330.0060.00015.08
7.4.320.0070.00016.54
7.4.300.0000.00616.61
7.4.290.0030.00316.43
7.4.280.0040.00416.60
7.4.270.0000.00716.53
7.4.260.0090.00016.45
7.4.250.0050.00216.47
7.4.240.0000.00816.59
7.4.230.0030.00316.43
7.4.220.0160.00916.47
7.4.210.0030.01216.63
7.4.200.0030.00316.63
7.4.160.0120.00316.66
7.4.150.0100.00717.40
7.4.140.0100.01117.86
7.4.130.0070.01616.54
7.4.120.0120.00516.53
7.4.110.0060.01216.52
7.4.100.0140.00716.54
7.4.90.0110.00716.54
7.4.80.0030.01719.39
7.4.70.0120.01116.62
7.4.60.0050.01016.36
7.4.50.0000.00816.41
7.4.40.0080.00816.73
7.4.30.0080.01616.71
7.4.00.0090.00614.54
7.3.330.0000.00513.30
7.3.320.0050.00013.27
7.3.310.0050.00316.29
7.3.300.0000.00716.30
7.3.290.0130.00416.31
7.3.280.0120.00516.31
7.3.270.0100.01017.40
7.3.260.0100.00616.32
7.3.250.0130.00516.37
7.3.240.0090.01116.48
7.3.230.0140.00416.39
7.3.210.0070.01016.33
7.3.200.0140.01016.42
7.3.190.0070.01016.52
7.3.180.0110.00716.44
7.3.170.0040.01216.36
7.3.160.0090.00916.51
7.2.330.0100.00716.61
7.2.320.0090.00916.73
7.2.310.0070.01016.72
7.2.300.0160.00016.39
7.2.290.0110.01116.45
7.2.60.0100.00616.50
7.2.00.0090.00319.07
7.1.200.0090.00415.55
7.1.100.0070.00418.02
7.1.70.0000.00816.80
7.1.60.0090.01619.13
7.1.50.0080.01216.99
7.1.00.0070.07322.45
7.0.200.0450.00614.69
7.0.60.0130.08019.94
7.0.50.0100.06017.97
7.0.40.0030.04720.22
7.0.30.0300.07720.16
7.0.20.0230.07020.16
7.0.10.0200.07720.19
7.0.00.0000.04320.29
5.6.280.0100.04321.11
5.6.210.0070.06720.72
5.6.200.0100.08318.13
5.6.190.0030.04720.50
5.6.180.0000.09020.61
5.6.170.0200.05020.71
5.6.160.0000.05720.46
5.6.150.0100.08018.19
5.6.140.0000.09318.18
5.6.130.0030.09018.23
5.6.120.0030.08321.13
5.6.110.0070.04321.03
5.6.100.0070.07320.98
5.6.90.0000.04321.08
5.6.80.0000.07720.41
5.6.70.3630.04720.48
5.5.350.0070.06320.32
5.5.340.0100.06318.05
5.5.330.0070.08020.26
5.5.320.0000.08720.34
5.5.310.0170.04320.31
5.5.300.0100.05718.02
5.5.290.0000.04317.99
5.5.280.0130.04320.68
5.5.270.0130.04720.76
5.5.260.0030.06020.87
5.5.250.0130.08020.59
5.5.240.0000.07720.37
5.4.450.0730.06719.46
5.4.440.0270.05719.61
5.4.430.0070.06019.16
5.4.420.0200.05319.70
5.4.410.0170.05319.45
5.4.400.0100.05319.38
5.4.390.0370.03318.86
5.4.380.0600.06019.07
5.4.370.0400.05319.37
5.4.360.0570.07319.25
5.4.350.0670.06018.98
5.4.340.0570.04718.98
5.4.320.0570.05019.01
5.4.310.0330.06719.25
5.4.300.0630.06319.14
5.4.290.0630.07719.36
5.4.280.0700.05319.09
5.4.270.0730.05019.14
5.4.260.0800.06319.20
5.4.250.1000.07718.83
5.4.240.1070.06319.14
5.4.230.0830.08719.25
5.4.220.0930.08019.02
5.4.210.1100.06318.86
5.4.200.0930.07019.05
5.4.190.0830.05718.84
5.4.180.0870.07319.36
5.4.170.0770.05719.00
5.4.160.0800.04319.10
5.4.150.0700.05719.13
5.4.140.0800.06316.38
5.4.130.0730.05716.32
5.4.120.0600.05016.30
5.4.110.1000.06716.61
5.4.100.0600.06016.51
5.4.90.0630.04316.62
5.4.80.0700.04016.55
5.4.70.0500.05716.60
5.4.60.0570.05016.62
5.4.50.0730.04716.42
5.4.40.0530.05716.62
5.4.30.0570.04716.41
5.4.20.0530.05316.54
5.4.10.0600.04716.25
5.4.00.0630.04716.00

preferences:
52.05 ms | 400 KiB | 5 Q