3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coroutine1() { for ($i = 1; $i <= 5; $i++) { echo "coroutine1: {$i}\n"; yield; } } function coroutine2() { for ($i = 1; $i <= 10; $i++) { echo "coroutine2: {$i}\n"; $loop = yield; if ($i == 3) { echo "coroutine2 spawning coroutine3\n"; $loop->enqueue("#3", coroutine3()); } } } function coroutine3() { for ($i = 1; $i <= 5; $i++) { echo "coroutine3: {$i}\n"; yield; } } class EventLoop { private $tasks = []; public function enqueue($key, Generator $task) { $this->tasks[$key] = $task; } public function run() { foreach ($this->tasks as $key => $task) { $task->send($this); if (!$task->valid()) { echo "task {$key} complete\n"; unset($this->tasks[$key]); } } return !empty($this->tasks); } } $loop = new EventLoop(); $loop->enqueue("#1", coroutine1()); $loop->enqueue("#2", coroutine2()); while ($loop->run());

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.5.10.0110.00816.74
8.5.00.0120.01119.82
8.4.150.0030.00014.05
8.4.140.0100.01217.19
8.4.130.0060.00517.72
8.4.120.0100.00920.48
8.4.110.0120.00622.37
8.4.100.0050.00418.02
8.4.90.0140.00818.57
8.4.80.0130.00618.83
8.4.70.0090.00818.04
8.4.60.0110.00919.07
8.4.50.0100.01018.72
8.4.40.0160.00317.81
8.4.30.0080.00320.22
8.4.20.0100.01017.92
8.4.10.0060.00319.68
8.3.280.0110.00918.61
8.3.270.0140.00516.65
8.3.260.0140.00516.43
8.3.250.0090.00918.90
8.3.240.0120.01116.52
8.3.230.0130.00916.57
8.3.220.0090.01019.03
8.3.210.0100.00818.59
8.3.200.0070.00216.32
8.3.190.0110.00918.86
8.3.180.0130.00617.39
8.3.170.0120.00620.46
8.3.160.0110.00716.66
8.3.150.0070.01117.33
8.3.140.0090.00916.60
8.3.130.0080.00018.62
8.3.120.0050.00519.21
8.3.110.0090.00018.43
8.3.100.0000.00824.06
8.3.90.0050.00326.77
8.3.80.0060.00316.75
8.3.70.0090.00616.63
8.3.60.0170.00716.75
8.3.50.0150.00224.54
8.3.40.0100.01021.93
8.3.30.0140.00318.79
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0140.00620.28
8.2.280.0110.00818.51
8.2.270.0060.00317.17
8.2.260.0070.00316.64
8.2.250.0080.00016.90
8.2.240.0060.00317.45
8.2.230.0090.00620.94
8.2.220.0040.00437.54
8.2.210.0090.00626.77
8.2.200.0080.00016.75
8.2.190.0090.00617.00
8.2.180.0060.01225.92
8.2.170.0170.00318.91
8.2.160.0040.01122.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00726.35
8.2.110.0030.00620.52
8.2.100.0070.00318.28
8.2.90.0060.00318.16
8.2.80.0040.00417.97
8.2.70.0000.00818.05
8.2.60.0050.00517.94
8.2.50.0000.00818.10
8.2.40.0040.00719.30
8.2.30.0050.00319.19
8.2.20.0000.00718.04
8.2.10.0050.00319.34
8.2.00.0050.00219.19
8.1.330.0100.00921.51
8.1.320.0080.01117.88
8.1.310.0040.00417.89
8.1.300.0040.00418.44
8.1.290.0090.00018.88
8.1.280.0140.00725.92
8.1.270.0040.00423.89
8.1.260.0040.00428.09
8.1.250.0070.00028.09
8.1.240.0110.00020.65
8.1.230.0120.00020.97
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0100.00017.35
8.1.190.0030.00617.25
8.1.180.0050.00318.10
8.1.170.0000.00918.56
8.1.160.0000.00718.94
8.1.150.0040.00418.82
8.1.140.0000.00718.96
8.1.130.0000.00720.27
8.1.120.0000.00717.49
8.1.110.0050.00317.51
8.1.100.0050.00317.48
8.1.90.0040.00417.48
8.1.80.0030.00617.45
8.1.70.0030.00617.35
8.1.60.0030.00617.64
8.1.50.0040.00417.55
8.1.40.0030.00617.51
8.1.30.0050.00817.68
8.1.20.0030.00617.48
8.1.10.0040.00417.62
8.1.00.0040.00417.36
8.0.300.0000.00819.73
8.0.290.0040.00416.75
8.0.280.0000.00718.46
8.0.270.0050.00316.76
8.0.260.0050.00320.20
8.0.250.0070.00016.90
8.0.240.0000.00817.02
8.0.230.0030.00316.99
8.0.220.0030.00316.96
8.0.210.0030.00316.95
8.0.200.0000.00816.93
8.0.190.0040.00417.04
8.0.180.0000.00716.89
8.0.170.0040.00416.97
8.0.160.0050.00316.86
8.0.150.0000.00816.97
8.0.140.0030.00716.86
8.0.130.0030.00313.35
8.0.120.0040.00416.97
8.0.110.0050.00216.92
8.0.100.0000.00716.89
8.0.90.0030.00316.80
8.0.80.0080.00616.94
8.0.70.0000.00816.86
8.0.60.0050.00316.95
8.0.50.0070.00016.95
8.0.30.0060.01117.27
8.0.20.0060.01317.13
8.0.10.0050.00217.13
8.0.00.0080.01116.78
7.4.330.0040.00015.55
7.4.320.0030.00316.63
7.4.300.0070.00316.60
7.4.290.0030.00616.57
7.4.280.0030.00516.65
7.4.270.0030.00316.61
7.4.260.0000.00713.30
7.4.250.0040.00416.54
7.4.240.0070.00016.44
7.4.230.0040.00416.65
7.4.220.0020.00516.55
7.4.210.0040.01316.56
7.4.200.0050.00516.46
7.4.130.0120.00616.46
7.4.120.0000.01916.34
7.4.110.0210.01316.43
7.4.100.0240.00816.71
7.4.90.0180.01616.52
7.4.80.0180.01816.46
7.4.70.0240.00916.37
7.4.60.0230.00716.42
7.4.50.0250.00916.38
7.4.40.0200.01016.40
7.4.30.0300.00716.57
7.4.20.0260.00716.54
7.4.10.0300.00316.41
7.4.00.0090.01216.56
7.3.330.0000.00816.25
7.3.320.0050.00013.23
7.3.310.0030.00316.32
7.3.300.0000.00616.41
7.3.290.0100.00916.36
7.3.260.0110.00616.27
7.3.240.0300.00416.66
7.3.230.0290.00016.18
7.3.220.0220.01616.48
7.3.210.0170.01816.64
7.3.200.0260.00716.47
7.3.190.0330.00016.57
7.3.180.0210.01516.65
7.3.170.0290.00916.62
7.3.160.0170.01716.54
7.3.150.0270.01016.63
7.3.140.0240.01416.43
7.3.130.0310.00816.32
7.3.120.0190.01316.67
7.3.110.0240.00916.40
7.3.100.0160.01616.38
7.3.90.0220.00816.23
7.3.80.0300.00416.54
7.3.70.0170.01216.42
7.3.60.0180.01416.33
7.3.50.0320.00916.39
7.3.40.0320.00016.46
7.3.30.0290.00916.33
7.3.20.0310.00716.48
7.3.10.0260.00616.44
7.3.00.0260.01016.57
7.2.340.0250.01116.50
7.2.330.0240.01016.47
7.2.320.0270.00316.82
7.2.310.0250.00616.54
7.2.300.0280.00716.81
7.2.290.0280.01216.80
7.2.280.0220.01416.39
7.2.270.0260.01016.67
7.2.260.0320.00416.69
7.2.250.0230.01216.80
7.2.240.0230.00816.75
7.2.230.0210.01216.84
7.2.220.0170.01516.77
7.2.210.0210.00916.82
7.2.200.0180.01416.68
7.2.190.0270.00916.61
7.2.180.0270.00616.56
7.2.170.0270.01316.68
7.2.160.0240.01316.61
7.2.150.0250.02016.89
7.2.140.0150.01916.54
7.2.130.0210.01516.68
7.2.120.0120.02016.67
7.2.110.0260.00916.66
7.2.100.0190.01416.71
7.2.90.0300.00316.66
7.2.80.0260.00916.69
7.2.70.0310.00916.65
7.2.60.0250.01116.83
7.2.50.0300.00716.68
7.2.40.0280.00616.66
7.2.30.0240.01216.77
7.2.20.0260.01416.93
7.2.10.0360.01216.63
7.2.00.0220.01316.77

preferences:
186.7 ms | 403 KiB | 5 Q