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->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.0150.00616.75
8.3.50.0100.01221.92
8.3.40.0100.00318.71
8.3.30.0110.00418.68
8.3.20.0080.00020.38
8.3.10.0000.00823.66
8.3.00.0050.00519.38
8.2.180.0070.00717.98
8.2.170.0040.01122.96
8.2.160.0070.00720.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00017.63
8.2.110.0070.00322.27
8.2.100.0090.00317.93
8.2.90.0040.00419.23
8.2.80.0060.00317.97
8.2.70.0050.00317.50
8.2.60.0030.00517.79
8.2.50.0040.00418.07
8.2.40.0050.00319.38
8.2.30.0040.00420.62
8.2.20.0070.00017.79
8.2.10.0040.00418.08
8.2.00.0000.00718.12
8.1.280.0000.01425.92
8.1.270.0040.00423.70
8.1.260.0080.00026.35
8.1.250.0100.00328.09
8.1.240.0070.00422.52
8.1.230.0080.00317.68
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0070.00317.35
8.1.190.0040.00417.25
8.1.180.0000.00718.10
8.1.170.0080.00019.03
8.1.160.0040.00421.95
8.1.150.0030.00518.79
8.1.140.0000.00819.49
8.1.130.0040.00417.71
8.1.120.0050.00317.49
8.1.110.0060.00317.39
8.1.100.0000.00717.44
8.1.90.0040.00417.46
8.1.80.0000.00817.36
8.1.70.0070.00017.42
8.1.60.0030.00517.47
8.1.50.0040.00417.43
8.1.40.0000.00817.56
8.1.30.0000.00817.56
8.1.20.0000.00817.68
8.1.10.0030.00917.51
8.1.00.0090.00017.31
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0000.00718.32
8.0.270.0000.00717.27
8.0.260.0000.00717.30
8.0.250.0040.00417.02
8.0.240.0070.00016.98
8.0.230.0000.00816.89
8.0.220.0000.00716.98
8.0.210.0070.00016.93
8.0.200.0000.00616.98
8.0.190.0060.00316.99
8.0.180.0040.00416.99
8.0.170.0000.00716.79
8.0.160.0050.00316.98
8.0.150.0070.00016.99
8.0.140.0000.00716.95
8.0.130.0030.00313.39
8.0.120.0040.00416.86
8.0.110.0040.00416.88
8.0.100.0040.00416.91
8.0.90.0050.00217.02
8.0.80.0060.00916.96
8.0.70.0040.00416.82
8.0.60.0000.00716.86
8.0.50.0040.00416.77
8.0.30.0150.01417.11
8.0.20.0050.01317.40
8.0.10.0040.00416.95
8.0.00.0050.01316.90
7.4.330.0060.00015.17
7.4.320.0030.00316.41
7.4.300.0060.00016.51
7.4.290.0040.00416.63
7.4.280.0000.00716.43
7.4.270.0030.00316.49
7.4.260.0000.00716.39
7.4.250.0040.00416.50
7.4.240.0040.00416.55
7.4.230.0030.00316.52
7.4.220.0130.00616.60
7.4.210.0110.00516.59
7.4.200.0000.00716.54
7.4.160.0210.00316.61
7.4.150.0110.00717.40
7.4.140.0090.01017.86
7.4.130.0060.01116.57
7.4.120.0070.01416.65
7.4.110.0160.00816.57
7.4.100.0110.00616.46
7.4.90.0000.01716.43
7.4.80.0060.01619.39
7.4.70.0110.00816.53
7.4.60.0080.00816.50
7.4.50.0000.00816.48
7.4.40.0120.01216.66
7.4.30.0030.01316.38
7.4.10.0040.01414.99
7.4.00.0050.01214.84
7.3.330.0000.00613.19
7.3.320.0000.00613.10
7.3.310.0030.00316.32
7.3.300.0030.00316.20
7.3.290.0000.00716.32
7.3.280.0050.01316.33
7.3.270.0090.00917.40
7.3.260.0140.00816.61
7.3.250.0100.00916.49
7.3.240.0070.01016.49
7.3.230.0040.01316.57
7.3.210.0130.00416.68
7.3.200.0030.01716.44
7.3.190.0030.01316.46
7.3.180.0070.01016.37
7.3.170.0100.01316.51
7.3.160.0060.01316.60
7.3.130.0100.01015.10
7.3.120.0090.00915.06
7.3.110.0040.00814.98
7.3.100.0090.00614.59
7.3.90.0110.00715.04
7.3.80.0070.00414.74
7.3.70.0040.00814.84
7.3.60.0090.00614.63
7.3.50.0070.01114.70
7.3.40.0030.01014.71
7.3.30.0080.00414.96
7.3.20.0000.01516.56
7.3.10.0110.00716.71
7.3.00.0030.00716.68
7.2.330.0170.00316.72
7.2.320.0140.00316.75
7.2.310.0070.01016.81
7.2.300.0080.01116.74
7.2.290.0140.00416.73
7.2.260.0070.01115.20
7.2.250.0130.00615.16
7.2.240.0070.01015.14
7.2.230.0070.01015.27
7.2.220.0130.00314.90
7.2.210.0090.00314.92
7.2.200.0030.01115.08
7.2.190.0040.01515.03
7.2.180.0110.00414.89
7.2.170.0040.00415.08
7.2.160.0060.00614.99
7.2.150.0110.00417.04
7.2.140.0100.00317.00
7.2.130.0070.00716.80
7.2.120.0040.01216.92
7.2.110.0000.01416.61
7.2.100.0080.00416.84
7.2.90.0090.00917.02
7.2.80.0110.00317.09
7.2.70.0070.01116.98
7.2.60.0110.00817.05
7.2.50.0100.00716.89
7.2.40.0070.00716.93
7.2.30.0080.00817.03
7.2.20.0170.00017.02
7.2.10.0030.01016.88
7.2.00.0020.01518.14
7.1.330.0080.00815.86
7.1.320.0090.00615.89
7.1.310.0040.01115.87
7.1.300.0070.00715.72
7.1.290.0090.00015.82
7.1.280.0070.00715.63
7.1.270.0060.00615.79
7.1.260.0060.00615.83
7.1.250.0100.00315.81
7.1.240.0110.00415.60
7.1.230.0080.00415.74
7.1.220.0090.00615.80
7.1.210.0060.01315.89
7.1.200.0080.01015.55
7.1.190.0070.01815.50
7.1.180.0030.01015.70
7.1.170.0030.01015.58
7.1.160.0120.00315.86
7.1.150.0090.00615.69
7.1.140.0130.00316.02
7.1.130.0040.01115.73
7.1.120.0070.01115.58
7.1.110.0120.00015.61
7.1.100.0030.01317.00
7.1.90.0090.00615.38
7.1.80.0060.00615.60
7.1.70.0040.00416.23
7.1.60.0060.01217.71
7.1.50.0100.00925.33
7.1.40.0000.01315.86
7.1.30.0040.01115.82
7.1.20.0070.01015.93
7.1.10.0000.01415.85
7.1.00.0050.04019.04
7.0.330.0090.00315.12
7.0.320.0070.00315.26
7.0.310.0110.00415.44
7.0.300.0090.00615.38
7.0.290.0000.00915.29
7.0.280.0090.00615.25
7.0.270.0070.01015.39
7.0.260.0070.00715.39
7.0.250.0040.00815.16
7.0.240.0110.00315.45
7.0.230.0100.00315.48
7.0.220.0070.00415.42
7.0.210.0050.00315.14
7.0.200.0620.00715.21
7.0.190.0030.00615.45
7.0.180.0110.00415.19
7.0.170.0060.00615.51
7.0.160.0110.00415.21
7.0.150.0090.00315.35
7.0.140.0030.01015.51
7.0.130.0060.01015.52
7.0.120.0040.01115.21
7.0.110.0070.00415.49
7.0.100.0070.00715.42
7.0.90.0030.00715.52
7.0.80.0150.00015.47
7.0.70.0130.00615.57
7.0.60.0060.02617.65
7.0.50.0030.02616.73
7.0.40.0070.04716.82
7.0.30.0050.02916.90
7.0.20.0180.04216.67
7.0.10.0060.02316.80
7.0.00.0070.04516.79
5.6.400.0060.00614.24
5.6.390.0000.01614.22
5.6.380.0040.01114.29
5.6.370.0070.01014.06
5.6.360.0030.01014.18
5.6.350.0090.00613.96
5.6.340.0120.00314.03
5.6.330.0150.00314.21
5.6.320.0090.00614.30
5.6.310.0070.00714.32
5.6.300.0000.01513.96
5.6.290.0070.01014.18
5.6.280.0050.03217.57
5.6.270.0090.00614.16
5.6.260.0070.00714.23
5.6.250.0110.00413.99
5.6.240.0110.00714.09
5.6.230.0070.01113.94
5.6.220.0070.00714.11
5.6.210.0050.03317.27
5.6.200.0070.02716.21
5.6.190.0050.03317.41
5.6.180.0130.02717.16
5.6.170.0100.02317.28
5.6.160.0070.03317.31
5.6.150.0030.03916.09
5.6.140.0050.02416.22
5.6.130.0100.03016.09
5.6.120.0070.04217.40
5.6.110.0070.04517.63
5.6.100.0110.03117.48
5.6.90.0050.04417.57
5.6.80.0080.04317.20
5.6.70.0030.00613.84
5.6.60.0100.00314.13
5.6.50.0000.00813.84
5.6.40.0060.00613.89
5.6.30.0080.00513.95
5.6.20.0030.01013.95
5.6.10.0090.00314.06
5.6.00.0040.00413.92
5.5.380.0040.00714.04
5.5.370.0100.01013.98
5.5.360.0070.01014.02
5.5.350.1900.02117.24
5.5.340.0030.02815.99
5.5.330.0060.03017.15
5.5.320.0110.02517.25
5.5.310.0200.04217.22
5.5.300.0050.03216.05
5.5.290.0070.04415.95
5.5.280.0060.02317.42
5.5.270.0100.04217.50
5.5.260.0070.04417.67
5.5.250.0020.02817.19
5.5.240.0100.04417.08
5.5.230.0000.01113.91
5.5.220.0090.00614.05
5.5.210.0000.00813.88
5.5.200.0000.01513.63
5.5.190.0030.01013.65
5.5.180.0090.00914.11
5.5.170.0060.00613.70
5.5.160.0030.00913.46
5.5.150.0070.00413.83
5.5.140.0070.00713.95
5.5.130.0030.01013.65
5.5.120.0030.01214.15
5.5.110.0000.01013.70
5.5.100.0000.00914.12
5.5.90.0030.00714.14
5.5.80.0070.00313.50
5.5.70.0080.00413.73
5.5.60.0040.00714.03
5.5.50.0030.00913.65
5.5.40.0030.01013.93
5.5.30.0000.00813.43
5.5.20.0030.00913.73
5.5.10.0060.01213.70
5.5.00.0030.00914.02

preferences:
58.94 ms | 401 KiB | 5 Q