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 $val) { echo "Iteration!\n"; 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.60.0120.00416.63
8.3.50.0110.01121.92
8.3.40.0110.00318.70
8.3.30.0140.00018.67
8.3.20.0040.00420.16
8.3.10.0080.00023.66
8.3.00.0030.00717.50
8.2.180.0070.01418.29
8.2.170.0030.01022.96
8.2.160.0100.00320.35
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00417.50
8.2.110.0060.00622.34
8.2.100.0060.00617.93
8.2.90.0030.00519.05
8.2.80.0030.00617.97
8.2.70.0000.00817.50
8.2.60.0040.00417.77
8.2.50.0050.00318.07
8.2.40.0000.00821.10
8.2.30.0050.00220.68
8.2.20.0080.00017.57
8.2.10.0000.00717.92
8.2.00.0050.00318.05
8.1.280.0110.00425.92
8.1.270.0000.00823.96
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0090.00022.56
8.1.230.0110.00017.66
8.1.220.0040.00417.79
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0000.00817.36
8.1.180.0030.00618.10
8.1.170.0050.00320.30
8.1.160.0050.00321.88
8.1.150.0040.00418.83
8.1.140.0090.00019.50
8.1.130.0070.00017.58
8.1.120.0000.00717.36
8.1.110.0040.00417.46
8.1.100.0030.00517.45
8.1.90.0040.00417.35
8.1.80.0030.00617.48
8.1.70.0080.00017.32
8.1.60.0070.00017.57
8.1.50.0040.00417.43
8.1.40.0040.00417.41
8.1.30.0040.00417.64
8.1.20.0000.00717.66
8.1.10.0040.00417.52
8.1.00.0050.00317.43
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0070.00018.36
8.0.270.0030.00517.18
8.0.260.0030.00317.31
8.0.250.0040.00417.00
8.0.240.0040.00416.90
8.0.230.0030.00316.85
8.0.220.0030.00316.94
8.0.210.0000.00716.79
8.0.200.0030.00316.85
8.0.190.0050.00316.95
8.0.180.0000.00716.81
8.0.170.0000.00816.80
8.0.160.0030.00316.95
8.0.150.0030.00316.75
8.0.140.0000.00716.85
8.0.130.0040.00413.28
8.0.120.0080.00016.77
8.0.110.0080.00016.76
8.0.100.0020.00516.96
8.0.90.0040.00416.72
8.0.80.0120.01016.86
8.0.70.0050.00217.00
8.0.60.0050.00316.77
8.0.50.0040.00416.89
8.0.30.0110.01017.07
8.0.20.0100.00917.40
8.0.10.0000.00817.02
8.0.00.0070.01016.70
7.4.330.0000.00515.08
7.4.320.0060.00016.51
7.4.300.0060.00016.43
7.4.290.0070.00016.54
7.4.280.0040.00416.54
7.4.270.0030.00316.40
7.4.260.0040.00416.42
7.4.250.0000.00716.30
7.4.240.0030.00316.48
7.4.230.0000.00716.38
7.4.220.0130.01316.54
7.4.210.0030.01016.63
7.4.200.0030.00516.66
7.4.160.0030.01216.39
7.4.150.0130.00517.40
7.4.140.0080.01117.86
7.4.130.0090.01216.48
7.4.120.0120.00516.56
7.4.110.0120.00616.44
7.4.100.0140.00716.49
7.4.90.0120.00616.43
7.4.80.0110.00619.39
7.4.70.0060.00916.45
7.4.60.0090.00616.51
7.4.50.0050.00316.66
7.4.40.0060.01016.24
7.4.30.0100.00716.38
7.4.00.0060.01015.03
7.3.330.0020.00213.28
7.3.320.0030.00313.37
7.3.310.0000.00716.39
7.3.300.0080.00016.27
7.3.290.0110.00616.24
7.3.280.0090.00816.31
7.3.270.0120.00417.40
7.3.260.0030.01316.45
7.3.250.0130.00616.48
7.3.240.0070.01516.60
7.3.230.0060.01016.52
7.3.210.0080.00816.44
7.3.200.0080.01416.38
7.3.190.0130.00416.43
7.3.180.0070.01316.25
7.3.170.0090.00816.64
7.3.160.0120.00316.28
7.3.120.0060.01315.28
7.3.110.0030.01415.28
7.3.100.0070.01015.28
7.3.90.0070.01015.28
7.3.80.0060.01215.28
7.3.70.0100.00015.28
7.3.60.0060.01015.28
7.3.50.0070.00715.28
7.3.40.0060.00915.28
7.3.30.0080.00415.28
7.3.20.0060.00616.69
7.3.10.0030.01216.82
7.3.00.0130.00316.50
7.2.330.0080.00816.64
7.2.320.0110.00616.68
7.2.310.0120.00616.58
7.2.300.0100.00716.63
7.2.290.0060.01116.65
7.2.250.0040.01515.28
7.2.240.0130.00915.28
7.2.230.0130.00315.28
7.2.220.0030.01215.28
7.2.210.0030.01215.28
7.2.200.0030.00915.28
7.2.190.0000.01315.28
7.2.180.0030.01315.28
7.2.170.0030.01015.28
7.2.60.0090.00616.51
7.2.00.0030.00919.49
7.1.330.0100.00315.94
7.1.320.0040.01115.80
7.1.310.0000.01415.67
7.1.300.0070.01015.75
7.1.290.0000.00915.83
7.1.280.0040.00815.76
7.1.270.0030.01315.98
7.1.260.0060.00915.91
7.1.200.0070.00315.41
7.1.100.0060.00617.99
7.1.70.0030.00716.76
7.1.60.0120.01219.13
7.1.50.0030.01916.95
7.1.00.0000.08022.42
7.0.200.0420.00714.80
7.0.60.0130.07320.04
7.0.50.0030.06717.99
7.0.40.0070.04720.11
7.0.30.0230.04720.08
7.0.20.0170.08720.19
7.0.10.0270.03320.25
7.0.00.0130.07320.32
5.6.280.0070.07321.07
5.6.210.0070.06320.47
5.6.200.0000.04718.19
5.6.190.0000.05020.58
5.6.180.0070.03720.67
5.6.170.0170.04720.56
5.6.160.0000.09320.50
5.6.150.0070.03718.18
5.6.140.0170.07318.15
5.6.130.0000.07018.14
5.6.120.0130.06721.00
5.6.110.0070.08720.98
5.6.100.0070.03720.99
5.6.90.0070.06721.10
5.6.80.0030.04720.39
5.6.70.4200.03720.50
5.5.350.0030.07720.34
5.5.340.0030.09018.09
5.5.330.0070.04320.25
5.5.320.0030.04020.34
5.5.310.0400.06320.30
5.5.300.0100.04018.03
5.5.290.0130.06717.98
5.5.280.0070.08720.89
5.5.270.0200.08020.79
5.5.260.0070.07320.76
5.5.250.0070.03720.69
5.5.240.0100.04720.20
5.4.450.0730.07019.61
5.4.440.0630.06719.30
5.4.430.0830.04719.57
5.4.420.0630.05719.19
5.4.410.0670.06019.51
5.4.400.0800.06319.13
5.4.390.0800.07319.06
5.4.380.0700.05319.14
5.4.370.0770.05019.28
5.4.360.0630.06019.28
5.4.350.0670.05319.37
5.4.340.0770.05019.29
5.4.320.0600.05319.26
5.4.310.0870.05319.22
5.4.300.0630.05019.25
5.4.290.0700.06319.30
5.4.280.0730.05319.22
5.4.270.0730.05319.25
5.4.260.0870.04719.30
5.4.250.0730.05718.83
5.4.240.0800.04719.27
5.4.230.0730.05319.27
5.4.220.0700.05719.00
5.4.210.0730.05319.29
5.4.200.0870.05319.14
5.4.190.0830.04719.04
5.4.180.0730.04019.14
5.4.170.0670.06019.13
5.4.160.0630.04719.28
5.4.150.0600.05019.34
5.4.140.0630.05316.31
5.4.130.0570.05016.50
5.4.120.0500.05716.51
5.4.110.0530.06016.57
5.4.100.0700.05716.25
5.4.90.0730.03316.52
5.4.80.0670.04016.63
5.4.70.0970.04016.55
5.4.60.0630.04716.55
5.4.50.0670.04716.44
5.4.40.0570.05016.59
5.4.30.0630.04316.59
5.4.20.0600.04716.21
5.4.10.0600.05016.57
5.4.00.0530.06015.78

preferences:
56.93 ms | 401 KiB | 5 Q