3v4l.org

run code in 300+ PHP versions simultaneously
<?php $games = array(); $players = array_values($players); $tempplayers = $players; $n = count($players); $temp = $players; if (($n / 2) != round(($n / 2), 0)) { $rounds = $n; $games_per_go = ($n - 1) / 2; } else { $rounds = $n - 1; $games_per_go = $n / 2; } $offset = 0; $fixed = array_shift($tempplayers); $teams = $players; function scheduler($teams) { if (count($teams) % 2 != 0) { array_push($teams, "bye"); } $away = array_splice($teams, (count($teams) / 2)); $home = $teams; for ($i = 0; $i < count($home) + count($away) - 1; $i++) { for ($j = 0; $j < count($home); $j++) { $games[$i][$j][Home] = $home[$j]; $games[$i][$j][Away] = $away[$j]; } if (count($home) + count($away) - 1 > 2) { array_unshift($away, array_shift(arra($home, 1, 1))); array_push($home, array_pop($away)); } } return $games; } var_dump(scheduler([1,2,3,4,5,6]));

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.0130.00618.46
8.5.00.0110.01020.03
8.4.150.0020.00014.05
8.4.140.0120.01117.86
8.4.130.0060.00317.69
8.4.120.0080.01220.85
8.4.110.0070.00220.25
8.4.100.0070.00317.79
8.4.90.0120.00718.13
8.4.80.0160.00518.20
8.4.70.0130.00717.93
8.4.60.0150.00817.94
8.4.50.0100.00818.54
8.4.40.0080.00417.98
8.4.30.0130.00617.86
8.4.20.0100.01019.53
8.4.10.0060.00319.45
8.3.280.0110.00818.66
8.3.270.0140.00616.55
8.3.260.0140.00616.86
8.3.250.0110.00818.68
8.3.240.0110.00716.73
8.3.230.0130.00716.68
8.3.220.0100.00616.94
8.3.210.0090.01116.68
8.3.200.0100.00916.51
8.3.190.0070.01216.53
8.3.180.0140.00616.75
8.3.170.0070.01118.83
8.3.160.0030.00620.22
8.3.150.0100.00016.77
8.3.140.0040.00417.12
8.3.130.0040.00418.67
8.3.120.0060.00318.94
8.3.110.0070.00016.55
8.3.100.0030.00724.06
8.3.90.0030.00626.77
8.3.80.0030.00618.18
8.3.70.0130.00618.55
8.3.60.0080.00818.28
8.3.50.0100.00517.31
8.3.40.0040.01418.92
8.3.30.0130.00318.61
8.3.20.0070.00021.76
8.3.10.0070.00021.90
8.3.00.0030.00523.66
8.2.290.0050.00420.37
8.2.280.0100.00916.77
8.2.270.0120.00618.97
8.2.260.0050.00516.72
8.2.250.0040.00418.61
8.2.240.0090.00017.01
8.2.230.0040.00420.94
8.2.220.0080.00337.54
8.2.210.0040.00426.77
8.2.200.0040.00416.75
8.2.190.0180.00616.88
8.2.180.0150.00416.89
8.2.170.0000.01422.96
8.2.160.0070.00720.38
8.2.150.0070.00024.18
8.2.140.0000.00924.66
8.2.130.0030.00519.21
8.2.120.0050.00326.35
8.2.110.0090.00021.02
8.2.100.0040.00817.72
8.2.90.0050.00317.78
8.2.80.0080.00017.97
8.2.70.0030.00517.80
8.2.60.0000.00817.50
8.2.50.0040.00418.10
8.2.40.0050.00320.59
8.2.30.0000.00720.60
8.2.20.0000.00818.13
8.2.10.0040.00418.09
8.2.00.0040.00418.19
8.1.330.0130.00516.47
8.1.320.0100.00916.00
8.1.310.0140.00418.58
8.1.300.0060.01018.06
8.1.290.0030.00730.84
8.1.280.0120.00325.92
8.1.270.0040.00723.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00322.05
8.1.230.0070.00422.66
8.1.220.0000.00817.74
8.1.210.0040.00418.79
8.1.200.0060.00617.22
8.1.190.0040.00417.23
8.1.180.0060.00318.10
8.1.170.0060.00318.59
8.1.160.0040.00418.81
8.1.150.0070.00020.28
8.1.140.0040.00417.66
8.1.130.0070.00018.96
8.1.120.0040.00417.43
8.1.110.0040.00417.38
8.1.100.0040.00417.40
8.1.90.0040.00417.40
8.1.80.0000.00917.32
8.1.70.0000.00717.28
8.1.60.0030.00717.56
8.1.50.0030.00517.46
8.1.40.0000.00717.48
8.1.30.0000.00817.74
8.1.20.0040.00417.72
8.1.10.0030.00517.58
8.1.00.0030.00517.56
8.0.300.0030.00519.83
8.0.290.0080.00016.58
8.0.280.0000.00718.41
8.0.270.0030.00316.69
8.0.260.0040.00416.75
8.0.250.0000.00716.88
8.0.240.0040.00417.02
8.0.230.0050.00216.83
8.0.220.0050.00316.89
8.0.210.0000.00716.91
8.0.200.0000.00616.87
8.0.190.0040.00417.02
8.0.180.0040.00416.87
8.0.170.0000.01016.82
8.0.160.0040.00416.95
8.0.150.0030.00516.75
8.0.140.0070.00016.91
8.0.130.0000.00713.38
8.0.120.0090.00016.80
8.0.110.0080.00016.89
8.0.100.0000.00817.02
8.0.90.0000.00816.87
8.0.80.0070.01016.95
8.0.70.0000.00716.91
8.0.60.0040.00416.91
8.0.50.0040.00416.87
8.0.30.0100.00917.08
8.0.20.0080.01117.40
8.0.10.0000.00716.87
8.0.00.0090.00916.65
7.4.330.0000.00515.55
7.4.320.0030.00316.52
7.4.300.0030.00316.50
7.4.290.0030.00516.61
7.4.280.0000.00716.61
7.4.270.0040.00416.43
7.4.260.0070.00016.54
7.4.250.0040.00416.56
7.4.240.0040.00416.49
7.4.230.0000.00716.46
7.4.220.0080.00016.41
7.4.210.0080.00816.64
7.4.200.0040.00416.60
7.4.160.0070.01016.46
7.4.140.0100.00917.86
7.4.130.0080.01716.63
7.4.120.0090.00916.54
7.4.110.0000.01716.71
7.4.100.0140.00316.36
7.4.90.0100.00716.50
7.4.80.0160.00719.39
7.4.70.0070.01016.43
7.4.60.0100.00716.50
7.4.50.0100.00316.57
7.4.40.0070.01116.63
7.4.00.0060.00615.11
7.3.330.0000.00613.48
7.3.320.0030.00513.31
7.3.310.0000.00716.35
7.3.300.0060.00016.42
7.3.290.0090.00716.47
7.3.280.0080.00816.46
7.3.260.0100.00816.49
7.3.250.0070.01016.52
7.3.240.0070.01216.43
7.3.230.0110.00616.67
7.3.210.0040.01516.75
7.3.200.0040.01216.47
7.3.190.0060.00916.37
7.3.180.0060.00916.68
7.3.170.0130.00316.52
7.3.160.0090.00816.68
7.3.10.0060.00716.66
7.3.00.0070.00416.77
7.2.330.0040.01416.63
7.2.320.0080.00816.95
7.2.310.0130.01016.71
7.2.300.0110.00716.41
7.2.290.0140.00416.76
7.2.130.0090.00716.85
7.2.120.0060.00516.77
7.2.110.0080.00616.59
7.2.100.0050.01016.84
7.2.90.0030.00816.93
7.2.80.0050.00916.81
7.2.70.0070.00817.04
7.2.60.0080.00416.76
7.2.50.0090.00416.98
7.2.40.0090.00316.97
7.2.30.0080.00817.43
7.2.20.0100.00617.32
7.2.10.0080.01117.10
7.2.00.0110.00817.29
7.1.250.0000.01115.98
7.1.200.0020.01015.93
7.1.150.0110.01017.13
7.1.140.0090.01116.99
7.1.130.0120.01017.10
7.1.120.0170.01516.88
7.1.110.0170.01016.07
7.1.100.0090.01115.82
7.1.90.0110.00816.47
7.1.80.0150.00516.04
7.1.70.0170.00815.13
7.1.60.0260.01433.46
7.1.50.0300.01333.01
7.1.40.0310.01332.84
7.1.30.0320.01832.69
7.1.20.0300.01032.87
7.1.10.0140.01414.79
7.1.00.0080.01115.04

preferences:
37.31 ms | 403 KiB | 5 Q