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.0070.00718.55
8.3.50.0150.00921.98
8.3.40.0140.00318.68
8.3.30.0140.00018.57
8.3.20.0140.00020.35
8.3.10.0050.00323.57
8.3.00.0040.00419.13
8.2.180.0130.00916.50
8.2.170.0040.01122.96
8.2.160.0030.01020.39
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0070.01026.16
8.2.120.0090.00017.50
8.2.110.0060.00322.15
8.2.100.0090.00317.93
8.2.90.0080.00019.22
8.2.80.0000.00817.97
8.2.70.0000.00917.50
8.2.60.0030.00517.80
8.2.50.0030.00518.07
8.2.40.0000.00719.34
8.2.30.0040.00420.52
8.2.20.0080.00017.76
8.2.10.0030.00518.04
8.2.00.0030.00518.08
8.1.280.0110.00425.92
8.1.270.0040.00423.97
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0000.00922.48
8.1.230.0110.00017.75
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0040.00417.38
8.1.190.0000.00817.23
8.1.180.0000.00918.10
8.1.170.0000.00718.93
8.1.160.0050.00322.04
8.1.150.0080.00318.81
8.1.140.0050.00319.57
8.1.130.0030.00317.76
8.1.120.0070.00017.52
8.1.110.0040.00417.43
8.1.100.0040.00417.40
8.1.90.0050.00317.42
8.1.80.0030.00717.46
8.1.70.0070.00017.50
8.1.60.0060.00317.48
8.1.50.0000.00817.54
8.1.40.0030.00617.52
8.1.30.0000.00917.65
8.1.20.0030.00517.67
8.1.10.0000.00717.50
8.1.00.0040.00417.44
8.0.300.0050.00218.77
8.0.290.0000.00716.63
8.0.280.0080.00018.45
8.0.270.0000.00717.34
8.0.260.0000.00617.17
8.0.250.0050.00316.86
8.0.240.0000.00716.92
8.0.230.0050.00316.99
8.0.220.0030.00316.79
8.0.210.0030.00516.87
8.0.200.0030.00316.96
8.0.190.0050.00516.86
8.0.180.0040.00416.96
8.0.170.0050.00516.95
8.0.160.0030.00316.97
8.0.150.0000.00716.80
8.0.140.0040.00416.77
8.0.130.0050.00013.34
8.0.120.0030.00516.77
8.0.110.0000.00716.84
8.0.100.0000.00816.89
8.0.90.0050.00316.70
8.0.80.0030.01216.97
8.0.70.0000.00716.96
8.0.60.0000.00816.99
8.0.50.0000.00816.93
8.0.30.0090.00916.86
8.0.20.0160.00317.40
8.0.10.0040.00417.09
8.0.00.0100.00916.74
7.4.330.0000.00515.12
7.4.320.0000.00716.54
7.4.300.0070.00016.36
7.4.290.0000.00816.65
7.4.280.0040.00416.63
7.4.270.0030.00316.54
7.4.260.0030.00316.51
7.4.250.0000.00716.62
7.4.240.0060.00116.54
7.4.230.0030.00316.52
7.4.220.0060.01216.68
7.4.210.0070.00916.61
7.4.200.0030.00316.51
7.4.160.0080.00816.47
7.4.150.0120.00617.40
7.4.140.0150.00917.86
7.4.130.0050.01316.59
7.4.120.0090.00916.49
7.4.110.0130.01016.72
7.4.100.0120.01316.38
7.4.90.0030.01416.38
7.4.80.0140.00319.39
7.4.70.0130.00316.54
7.4.60.0100.00616.36
7.4.50.0040.00016.30
7.4.40.0130.01016.41
7.4.30.0100.00716.69
7.4.00.0070.00814.88
7.3.330.0050.00013.31
7.3.320.0000.00513.27
7.3.310.0030.00316.33
7.3.300.0000.00716.26
7.3.290.0030.00316.37
7.3.280.0080.00716.28
7.3.270.0100.01417.40
7.3.260.0090.01216.41
7.3.250.0120.00716.43
7.3.240.0140.00316.50
7.3.230.0060.01116.62
7.3.210.0150.00416.37
7.3.200.0050.01116.38
7.3.190.0080.00816.61
7.3.180.0040.01116.36
7.3.170.0030.01416.48
7.3.160.0070.01016.46
7.3.120.0090.00914.65
7.3.110.0060.00915.04
7.3.100.0030.01214.90
7.3.90.0060.00615.05
7.3.80.0130.00314.83
7.3.70.0040.01114.90
7.3.60.0120.00614.94
7.3.50.0030.01014.92
7.3.40.0070.00714.86
7.3.30.0030.00614.63
7.3.20.0160.00016.77
7.3.10.0100.00716.57
7.3.00.0060.00616.53
7.2.330.0110.00716.68
7.2.320.0120.01216.38
7.2.310.0060.01116.72
7.2.300.0040.01516.66
7.2.290.0090.00916.54
7.2.250.0030.01714.98
7.2.240.0000.01515.25
7.2.230.0100.00615.20
7.2.220.0080.00814.93
7.2.210.0030.01215.11
7.2.200.0140.00415.13
7.2.190.0090.00614.79
7.2.180.0030.01014.90
7.2.170.0110.00414.92
7.2.60.0100.00316.73
7.2.00.0080.00419.41
7.1.330.0040.01215.88
7.1.320.0060.00915.97
7.1.310.0030.01315.83
7.1.300.0000.01315.80
7.1.290.0050.00315.83
7.1.280.0120.00315.79
7.1.270.0030.01415.69
7.1.260.0090.00315.93
7.1.200.0030.01215.82
7.1.100.0000.01118.34
7.1.70.0000.00917.00
7.1.60.0040.01519.43
7.1.50.0030.01016.72
7.1.00.0000.08022.40
7.0.200.0130.00614.97
7.0.60.0070.06719.96
7.0.50.0030.04017.74
7.0.40.0070.05720.24
7.0.30.0430.07020.12
7.0.20.0330.05320.19
7.0.10.0000.04720.15
7.0.00.0170.07020.05
5.6.280.0070.04020.86
5.6.210.0100.06020.55
5.6.200.0070.08018.15
5.6.190.0030.05020.68
5.6.180.0300.07720.53
5.6.170.0170.04720.56
5.6.160.0030.07020.44
5.6.150.0000.08718.16
5.6.140.0000.04318.14
5.6.130.0070.04018.11
5.6.120.0100.08021.00
5.6.110.0070.08021.01
5.6.100.0070.04020.96
5.6.90.0030.04721.12
5.6.80.0070.03720.44
5.5.350.0230.04320.30
5.5.340.0130.07017.98
5.5.330.0070.04320.35
5.5.320.0270.04020.20
5.5.310.0300.04720.38
5.5.300.0030.08717.99
5.5.290.0170.07017.95
5.5.280.0070.07320.80
5.5.270.0130.07320.79
5.5.260.0100.08320.65
5.5.250.0100.03320.54
5.5.240.0170.07020.07
5.4.450.0130.05719.70
5.4.440.0230.04719.34
5.4.430.0230.04319.44
5.4.420.0070.06019.57
5.4.410.0170.05319.32
5.4.400.0230.04318.99
5.4.390.0170.05019.01
5.4.380.0130.06019.15
5.4.370.0170.05019.28
5.4.360.0130.05319.25
5.4.350.0170.04718.98
5.4.340.0130.05319.15
5.4.320.0070.06019.17
5.4.310.0270.05319.15
5.4.300.0170.05719.16
5.4.290.0270.05019.05
5.4.280.0130.06319.14
5.4.270.0130.05319.32
5.4.260.0130.05719.28
5.4.250.0170.05019.11
5.4.240.0130.05319.27
5.4.230.0170.05018.88
5.4.220.0170.05318.86
5.4.210.0000.06719.14
5.4.200.0100.05318.98
5.4.190.0030.06719.29
5.4.180.0200.04318.97
5.4.170.0130.05319.02
5.4.160.0100.05318.96
5.4.150.0130.05319.12
5.4.140.0130.05016.34
5.4.130.0300.03716.34
5.4.120.0130.05016.39
5.4.110.0170.04716.45
5.4.100.0200.04316.63
5.4.90.0200.04316.42
5.4.80.0130.05016.61
5.4.70.0200.04316.60
5.4.60.0170.04716.55
5.4.50.0170.04316.60
5.4.40.0170.04716.50
5.4.30.0200.04316.40
5.4.20.0170.04716.25
5.4.10.0070.05716.16
5.4.00.0130.05015.99

preferences:
67.4 ms | 401 KiB | 5 Q