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.0060.00916.63
8.3.50.0100.00722.05
8.3.40.0110.00418.46
8.3.30.0110.00418.51
8.3.20.0080.00020.20
8.3.10.0030.00623.63
8.3.00.0080.00417.25
8.2.180.0120.00918.27
8.2.170.0140.00722.96
8.2.160.0030.01020.47
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00317.63
8.2.110.0030.00922.29
8.2.100.0060.00618.03
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0030.00517.75
8.2.60.0000.00817.80
8.2.50.0050.00318.07
8.2.40.0000.00821.18
8.2.30.0030.00320.69
8.2.20.0030.00517.69
8.2.10.0040.00417.99
8.2.00.0050.00218.12
8.1.280.0000.01425.92
8.1.270.0080.00023.69
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0090.00022.65
8.1.230.0090.00317.78
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0000.01017.22
8.1.190.0050.00317.24
8.1.180.0000.00818.10
8.1.170.0000.00820.37
8.1.160.0040.00421.95
8.1.150.0040.00418.85
8.1.140.0030.00519.50
8.1.130.0000.00717.82
8.1.120.0040.00417.36
8.1.110.0040.00417.47
8.1.100.0050.00317.36
8.1.90.0040.00417.42
8.1.80.0050.00317.50
8.1.70.0000.00717.49
8.1.60.0040.00417.48
8.1.50.0000.00817.42
8.1.40.0040.00417.43
8.1.30.0090.00017.67
8.1.20.0000.00817.65
8.1.10.0030.00517.48
8.1.00.0040.00417.52
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0040.00418.48
8.0.270.0070.00017.23
8.0.260.0030.00317.27
8.0.250.0030.00317.00
8.0.240.0070.00016.83
8.0.230.0030.00316.96
8.0.220.0000.00716.77
8.0.210.0070.00016.93
8.0.200.0070.00017.00
8.0.190.0040.00416.86
8.0.180.0000.00717.00
8.0.170.0050.00316.84
8.0.160.0040.00416.96
8.0.150.0030.00316.69
8.0.140.0040.00416.87
8.0.130.0040.00413.33
8.0.120.0040.00416.82
8.0.110.0040.00416.88
8.0.100.0000.00716.83
8.0.90.0000.00716.89
8.0.80.0090.01316.82
8.0.70.0030.00516.94
8.0.60.0070.00016.93
8.0.50.0040.00416.93
8.0.30.0060.01117.12
8.0.20.0130.00717.40
8.0.10.0000.00817.04
8.0.00.0120.00816.71
7.4.330.0000.00615.08
7.4.320.0000.00616.53
7.4.300.0000.00616.45
7.4.290.0000.00716.55
7.4.280.0040.00416.58
7.4.270.0000.00716.47
7.4.260.0000.00716.44
7.4.250.0050.00316.54
7.4.240.0050.00416.59
7.4.230.0060.00016.32
7.4.220.0150.00716.57
7.4.210.0070.00716.55
7.4.200.0030.00516.53
7.4.160.0130.00316.36
7.4.150.0070.01017.40
7.4.140.0100.01117.86
7.4.130.0110.00916.58
7.4.120.0060.01116.39
7.4.110.0150.00316.53
7.4.100.0060.01216.53
7.4.90.0090.00916.45
7.4.80.0100.00719.39
7.4.70.0030.01516.69
7.4.60.0090.01016.51
7.4.50.0080.00016.57
7.4.40.0120.00316.48
7.4.30.0170.00616.59
7.4.00.0050.01114.92
7.3.330.0060.00013.13
7.3.320.0000.00513.16
7.3.310.0000.00716.20
7.3.300.0000.00716.17
7.3.290.0050.01216.28
7.3.280.0110.00616.30
7.3.270.0150.00317.40
7.3.260.0120.00416.64
7.3.240.0070.01116.47
7.3.230.0070.01316.54
7.3.210.0040.01516.43
7.3.200.0040.01816.66
7.3.190.0080.00816.39
7.3.180.0080.00816.36
7.3.170.0030.01416.53
7.3.160.0070.00916.34
7.3.120.0080.01014.73
7.3.110.0030.01414.79
7.3.100.0040.01114.95
7.3.90.0070.00715.04
7.3.80.0070.00914.78
7.3.70.0030.00814.94
7.3.60.0050.00714.74
7.3.50.0040.01114.57
7.3.40.0020.00914.56
7.3.30.0100.00314.62
7.3.20.0080.00616.75
7.3.10.0040.00616.54
7.3.00.0040.00716.85
7.2.330.0030.01716.75
7.2.320.0090.00916.45
7.2.310.0110.00716.56
7.2.300.0110.00616.36
7.2.290.0100.00716.55
7.2.250.0070.00915.05
7.2.240.0100.01014.80
7.2.230.0030.01115.10
7.2.220.0040.01114.97
7.2.210.0070.00514.88
7.2.200.0050.00615.11
7.2.190.0070.00514.87
7.2.180.0100.00515.07
7.2.170.0050.00815.05
7.2.160.0130.00614.99
7.2.150.0040.00716.98
7.2.140.0060.00616.61
7.2.130.0070.00716.63
7.2.120.0110.00616.89
7.2.110.0000.01717.04
7.2.100.0060.00616.70
7.2.90.0090.00317.08
7.2.80.0030.00617.03
7.2.70.0100.00316.99
7.2.60.0050.00816.85
7.2.50.0070.00717.04
7.2.40.0030.00616.98
7.2.30.0070.01016.88
7.2.20.0060.00916.99
7.2.10.0030.01016.90
7.2.00.0030.01017.98
7.1.330.0060.00815.76
7.1.320.0070.00515.84
7.1.310.0080.00715.82
7.1.300.0040.00515.74
7.1.290.0070.00715.68
7.1.280.0060.00615.67
7.1.270.0070.00515.81
7.1.260.0080.00515.76
7.1.250.0040.01215.54
7.1.200.0040.00415.90
7.1.100.0090.00617.96
7.1.70.0040.00416.99
7.1.60.0110.01419.13
7.1.50.0060.01516.91
7.1.00.0100.07022.32
7.0.200.0270.01014.65
7.0.60.0100.07020.04
7.0.50.0100.03317.86
7.0.40.0170.07720.09
7.0.30.0330.06020.15
7.0.20.0130.04320.16
7.0.10.0130.04720.16
7.0.00.0070.09020.22
5.6.280.0070.03320.93
5.6.210.0000.05720.61
5.6.200.0130.07018.20
5.6.190.0070.08020.33
5.6.180.0030.07020.64
5.6.170.0300.06320.39
5.6.160.0030.08720.47
5.6.150.0130.05718.25
5.6.140.0130.05018.17
5.6.130.0070.04318.28
5.6.120.0130.08321.12
5.6.110.0030.09020.99
5.6.100.0000.08321.11
5.6.90.0070.08720.99
5.6.80.0030.08320.29
5.5.350.0070.08020.37
5.5.340.0030.04317.94
5.5.330.0100.06720.32
5.5.320.0000.05320.24
5.5.310.0230.08720.35
5.5.300.0000.06717.95
5.5.290.0130.04718.08
5.5.280.0170.07020.88
5.5.270.0070.04720.76
5.5.260.0170.05320.89
5.5.250.0100.07020.61
5.5.240.0130.04020.13
5.4.450.0700.06019.63
5.4.440.0770.05319.16
5.4.430.0700.05719.47
5.4.420.0700.05719.70
5.4.410.0730.06319.48
5.4.400.0770.05018.84
5.4.390.0700.05719.26
5.4.380.0600.05319.30
5.4.370.0600.05019.28
5.4.360.0800.04718.98
5.4.350.0530.05719.14
5.4.340.0630.04718.84
5.4.320.0630.05019.08
5.4.310.0700.04019.15
5.4.300.0570.05319.14
5.4.290.0570.05719.25
5.4.280.0670.04719.05
5.4.270.0630.04719.37
5.4.260.0600.05018.84
5.4.250.0700.04018.86
5.4.240.0600.05318.83
5.4.230.0570.05319.14
5.4.220.0600.05019.11
5.4.210.0630.05019.29
5.4.200.0730.06319.05
5.4.190.0670.04319.36
5.4.180.0470.06319.12
5.4.170.0630.04719.25
5.4.160.0600.05018.80
5.4.150.0570.05719.13
5.4.140.0630.06016.55
5.4.130.0570.04716.38
5.4.120.0630.04316.39
5.4.110.0870.03716.52
5.4.100.0800.04016.60
5.4.90.0670.05016.62
5.4.80.0830.04716.23
5.4.70.0530.05716.63
5.4.60.0970.03716.57
5.4.50.0700.05316.57
5.4.40.0800.04316.57
5.4.30.0770.04716.16
5.4.20.0900.05316.54
5.4.10.0730.05016.54
5.4.00.0830.04016.12

preferences:
36.64 ms | 401 KiB | 5 Q