3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { echo "Beginning gen1\n"; $x = yield 1; echo "Sup!\n"; $y = yield 2; var_dump($x + $y); } function yfgenerator() { echo "Beginning yfgenerator\n"; yield from gen1(); echo "Dawg\n"; yield from gen1(); } 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); var_dump($g->current()); $g->send(20); var_dump($g->current()); } iterationTest(yfiterator()); //iterationTest(yfgenerator()); echo "====================\n"; sendingTest(yfiterator()); //sendingTest(yfgenerator()); 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.0070.00718.43
8.3.50.0260.01322.11
8.3.40.0070.01018.73
8.3.30.0110.00418.71
8.3.20.0090.00022.09
8.3.10.0000.00823.40
8.3.00.0080.00019.26
8.2.180.0130.00616.63
8.2.170.0100.00322.96
8.2.160.0140.00020.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0060.00317.62
8.2.110.0080.00319.27
8.2.100.0090.00317.80
8.2.90.0040.00418.16
8.2.80.0060.00317.97
8.2.70.0050.00317.63
8.2.60.0050.00317.93
8.2.50.0050.00318.07
8.2.40.0000.00719.52
8.2.30.0000.00720.51
8.2.20.0040.00417.68
8.2.10.0000.00717.99
8.2.00.0050.00217.95
8.1.280.0090.00625.92
8.1.270.0030.00523.96
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0070.00322.13
8.1.230.0110.00022.75
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0000.00818.96
8.1.160.0050.00221.99
8.1.150.0030.00618.94
8.1.140.0040.00419.50
8.1.130.0030.00317.76
8.1.120.0040.00417.50
8.1.110.0040.00417.48
8.1.100.0040.00417.45
8.1.90.0000.00817.37
8.1.80.0070.00317.46
8.1.70.0070.00017.46
8.1.60.0000.00817.56
8.1.50.0030.00517.57
8.1.40.0080.00417.41
8.1.30.0040.00417.54
8.1.20.0050.00217.71
8.1.10.0050.00317.42
8.1.00.0000.00817.31
8.0.300.0050.00219.98
8.0.290.0000.00716.63
8.0.280.0030.00318.39
8.0.270.0050.00217.20
8.0.260.0000.00617.25
8.0.250.0080.00016.82
8.0.240.0040.00416.98
8.0.230.0040.00416.88
8.0.220.0000.00716.90
8.0.210.0080.00016.92
8.0.200.0000.00616.97
8.0.190.0110.00016.99
8.0.180.0000.00716.95
8.0.170.0060.00316.93
8.0.160.0030.00416.96
8.0.150.0070.00016.76
8.0.140.0000.00716.75
8.0.130.0030.00313.33
8.0.120.0080.00016.92
8.0.110.0040.00416.90
8.0.100.0000.00816.96
8.0.90.0040.00416.94
8.0.80.0040.01116.82
8.0.70.0020.00516.94
8.0.60.0030.00517.01
8.0.50.0080.00016.75
8.0.30.0080.01017.19
8.0.20.0090.01017.40
8.0.10.0050.00216.94
8.0.00.0090.00816.78
7.4.330.0060.00015.08
7.4.320.0060.00016.47
7.4.300.0000.00616.50
7.4.290.0020.00516.46
7.4.280.0060.00316.45
7.4.270.0000.00716.62
7.4.260.0040.00416.52
7.4.250.0040.00416.58
7.4.240.0050.00216.51
7.4.230.0000.00716.54
7.4.220.0040.01416.60
7.4.210.0060.01116.62
7.4.200.0000.00716.61
7.4.160.0030.01316.46
7.4.150.0130.00417.40
7.4.140.0150.01017.86
7.4.130.0100.00716.61
7.4.120.0120.00516.57
7.4.110.0130.00316.54
7.4.100.0120.00616.58
7.4.90.0180.00016.71
7.4.80.0160.00419.39
7.4.70.0130.00316.57
7.4.60.0080.00816.49
7.4.50.0000.00916.38
7.4.40.0120.00616.53
7.4.30.0090.01216.54
7.4.10.0070.01014.96
7.4.00.0060.01215.03
7.3.330.0000.00513.31
7.3.320.0000.00513.11
7.3.310.0000.00716.42
7.3.300.0030.00316.19
7.3.290.0000.00716.23
7.3.280.0080.01016.31
7.3.270.0120.00617.40
7.3.260.0100.01016.38
7.3.250.0130.00416.67
7.3.240.0100.00716.35
7.3.230.0090.01016.39
7.3.210.0080.00816.26
7.3.200.0100.01316.52
7.3.190.0080.00816.45
7.3.180.0100.00616.57
7.3.170.0030.01316.55
7.3.160.0060.01216.43
7.3.130.0060.01215.03
7.3.120.0100.00814.88
7.3.110.0030.01114.77
7.3.100.0110.00414.96
7.3.90.0070.00515.00
7.3.80.0080.00814.97
7.3.70.0070.00714.87
7.3.60.0050.01215.00
7.3.50.0070.00514.94
7.3.40.0060.00614.80
7.3.30.0060.01014.87
7.3.20.0080.00916.71
7.3.10.0070.00716.68
7.3.00.0060.00816.66
7.2.330.0090.01016.60
7.2.320.0170.00616.46
7.2.310.0160.00016.65
7.2.300.0070.01416.80
7.2.290.0070.01016.70
7.2.260.0040.01415.18
7.2.250.0090.01115.02
7.2.240.0000.01415.01
7.2.230.0080.00815.14
7.2.220.0100.00314.82
7.2.210.0080.00415.27
7.2.200.0040.01114.89
7.2.190.0080.01014.97
7.2.180.0060.00814.99
7.2.170.0040.01214.90
7.2.160.0120.00615.02
7.2.150.0060.01016.98
7.2.140.0070.00716.99
7.2.130.0040.01016.69
7.2.120.0070.00616.80
7.2.110.0070.00816.78
7.2.100.0050.00916.76
7.2.90.0060.01016.83
7.2.80.0060.00916.84
7.2.70.0060.00616.96
7.2.60.0070.00816.81
7.2.50.0040.01316.89
7.2.40.0070.00816.83
7.2.30.0010.01216.83
7.2.20.0050.00716.92
7.2.10.0090.00716.79
7.2.00.0030.01117.39
7.1.330.0010.01115.93
7.1.320.0070.00515.73
7.1.310.0040.00715.74
7.1.300.0060.00915.80
7.1.290.0040.00815.81
7.1.280.0030.00815.78
7.1.270.0020.00815.62
7.1.260.0100.00615.44
7.1.250.0070.00515.83
7.1.240.0120.00415.69
7.1.230.0050.00915.79
7.1.220.0060.00715.56
7.1.210.0060.00915.72
7.1.200.0040.01015.67
7.1.190.0050.00915.71
7.1.180.0060.00715.85
7.1.170.0030.01115.84
7.1.160.0070.00615.69
7.1.150.0100.00215.65
7.1.140.0080.00215.54
7.1.130.0070.00515.65
7.1.120.0030.01015.78
7.1.110.0100.00215.85
7.1.100.0060.00716.56
7.1.90.0100.00315.83
7.1.80.0050.00915.66
7.1.70.0060.00616.11
7.1.60.0070.01116.99
7.1.50.0070.00916.06
7.1.40.0100.00515.71
7.1.30.0070.00515.63
7.1.20.0070.01015.63
7.1.10.0080.00715.63
7.1.00.0050.03217.90
7.0.330.0050.01115.09
7.0.320.0080.00515.39
7.0.310.0020.01115.54
7.0.300.0070.00515.36
7.0.290.0030.00815.38
7.0.280.0030.00815.23
7.0.270.0060.00615.25
7.0.260.0000.01115.32
7.0.250.0080.00515.46
7.0.240.0030.00915.17
7.0.230.0040.01015.20
7.0.220.0060.00715.54
7.0.210.0020.00715.36
7.0.200.0090.00815.05
7.0.190.0080.00615.41
7.0.180.0110.00415.35
7.0.170.0040.01115.16
7.0.160.0090.00615.42
7.0.150.0050.00815.47
7.0.140.0050.00415.41
7.0.130.0080.00615.42
7.0.120.0020.01015.41
7.0.110.0030.00815.44
7.0.100.0060.00715.28
7.0.90.0050.01015.36
7.0.80.0070.00215.32
7.0.70.0080.00815.42
7.0.60.0040.02616.89
7.0.50.0080.01916.20
7.0.40.0060.02715.77
7.0.30.0170.02415.65
7.0.20.0130.02115.58
7.0.10.0070.01615.55
7.0.00.0040.02615.67
5.6.400.0090.00914.41
5.6.390.0000.01514.32
5.6.380.0050.01114.17
5.6.370.0030.01413.84
5.6.360.0080.00614.15
5.6.350.0060.00814.18
5.6.340.0050.00514.26
5.6.330.0080.00614.11
5.6.320.0060.00814.33
5.6.310.0100.00814.00
5.6.300.0060.00814.06
5.6.290.0130.00514.19
5.6.280.0060.02616.45
5.6.270.0070.00814.19
5.6.260.0050.00814.12
5.6.250.0090.00314.21
5.6.240.0060.00614.02
5.6.230.0070.00814.25
5.6.220.0080.00714.03
5.6.210.0090.02916.27
5.6.200.0060.03415.46
5.6.190.0080.01716.17
5.6.180.0160.02316.19
5.6.170.0110.03016.18
5.6.160.0070.02016.18
5.6.150.0040.03215.50
5.6.140.0070.02515.50
5.6.130.0060.01715.50
5.6.120.0100.02516.33
5.6.110.0100.02616.47
5.6.100.0030.02316.33
5.6.90.0040.02116.36
5.6.80.0060.01815.96
5.6.70.0070.00613.87
5.6.60.0030.01114.01
5.6.50.0040.00913.80
5.6.40.0060.00613.98
5.6.30.0050.01013.95
5.6.20.0080.00514.20
5.6.10.0080.01014.06
5.6.00.0090.00714.04
5.5.380.0080.00212.74
5.5.370.0080.00512.98
5.5.360.0020.01112.85
5.5.350.0070.02415.37
5.5.340.0030.03314.69
5.5.330.0070.02115.47
5.5.320.0100.02815.33
5.5.310.0180.02315.38
5.5.300.0060.01914.51
5.5.290.0080.02014.50
5.5.280.0070.01715.36
5.5.270.0050.03315.47
5.5.260.0080.02315.43
5.5.250.0030.01915.37
5.5.240.0080.02215.25
5.5.230.0090.00212.91
5.5.220.0020.00912.90
5.5.210.0040.00512.79
5.5.200.0050.00812.71
5.5.190.0040.00812.80
5.5.180.0090.00512.69
5.5.170.0030.00812.71
5.5.160.0070.00612.73
5.5.150.0110.00512.74
5.5.140.0090.00512.80
5.5.130.0100.00312.72
5.5.120.0080.00712.64
5.5.110.0050.01312.69
5.5.100.0070.00612.83
5.5.90.0070.00812.91
5.5.80.0060.00612.80
5.5.70.0000.01312.79
5.5.60.0070.00812.88
5.5.50.0090.00412.58
5.5.40.0070.00912.65
5.5.30.0070.00812.80
5.5.20.0050.00912.63
5.5.10.0060.00712.56
5.5.00.0060.00612.71
5.4.450.0230.02414.71
5.4.440.0180.02714.66
5.4.430.0080.02114.69
5.4.420.0100.02314.66
5.4.410.0110.02014.59
5.4.400.0110.01914.52
5.4.390.0100.02114.60
5.4.380.0080.02114.60
5.4.370.0070.02614.51
5.4.360.0100.03014.51
5.4.350.0100.01914.58
5.4.340.0190.02114.58
5.4.330.0050.00312.25
5.4.320.0140.01814.46
5.4.310.0100.01914.45
5.4.300.0110.01814.55
5.4.290.0100.02014.58
5.4.280.0100.02014.45
5.4.270.0110.01914.59
5.4.260.0080.02014.60
5.4.250.0110.02414.58
5.4.240.0030.02714.59
5.4.230.0090.02014.46
5.4.220.0100.01914.49
5.4.210.0060.02314.52
5.4.200.0080.02014.58
5.4.190.0060.02514.54
5.4.180.0060.02414.51
5.4.170.0050.02314.59
5.4.160.0060.02114.60
5.4.150.0080.02014.50
5.4.140.0050.02313.64
5.4.130.0240.01813.69
5.4.120.0210.01913.67
5.4.110.0230.01813.67
5.4.100.0190.02313.71
5.4.90.0200.02213.64
5.4.80.0210.01913.65
5.4.70.0080.02313.71
5.4.60.0010.02413.70
5.4.50.0080.01813.66
5.4.40.0080.01913.68
5.4.30.0090.02013.63
5.4.20.0090.01813.63
5.4.10.0080.01813.70
5.4.00.0040.02313.49

preferences:
68.38 ms | 401 KiB | 5 Q