3v4l.org

run code in 300+ PHP versions simultaneously
<?php $teams[0] = array(1884, 1602, 1550, 1442, 1666); $teams[1] = array(1560, 1958, 1660, 1500, 1440); $diff = array_sum($teams[0]) - array_sum($teams[1]); for ($i = 0; $i < 1000 && $diff != 0; ++$i) { $r1 = rand(0, 4); // assumes nine players on each team $r2 = rand(0, 4); $new_diff = $diff - ($teams[0][$r1] - $teams[1][$r2]) * 2; if (abs($new_diff) < abs($diff)) { // if the switch makes the teams more equal, then swap $tmp = $teams[0][$r1]; $teams[0][$r1] = $teams[1][$r2]; $teams[1][$r2] = $tmp; var_dump(abs($new_diff)); $diff = $new_diff; } }

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)
7.3.10.0090.00316.18
7.3.00.0090.00916.68
7.2.130.0170.00616.99
7.2.120.0040.01316.17
7.2.110.0240.00016.78
7.2.100.0180.01216.71
7.2.90.0050.01416.65
7.2.80.0290.00716.66
7.2.70.0450.01016.77
7.2.60.0320.00716.77
7.2.50.0080.00816.79
7.2.40.0030.01416.87
7.2.30.0310.00316.77
7.2.20.0260.00817.04
7.2.10.0110.00016.46
7.2.00.0100.00618.04
7.1.250.0140.00615.40
7.1.70.0000.01117.12
7.1.60.0160.00919.46
7.1.50.0040.01816.77
7.1.00.0070.07022.51
7.0.200.0080.00016.78
7.0.140.0070.07022.08
7.0.110.0100.03319.86
7.0.100.0030.04319.87
7.0.90.0170.03020.05
7.0.80.0130.03019.96
7.0.70.0030.03719.87
7.0.60.0130.03720.04
7.0.50.0100.03719.87
7.0.40.0030.03319.74
7.0.30.0070.03719.75
7.0.20.0070.03019.80
7.0.10.0070.03019.77
7.0.00.0100.03319.72
5.6.280.0030.07721.08
5.6.260.0100.04020.59
5.6.250.0070.03320.60
5.6.240.0100.03320.71
5.6.230.0030.03720.68
5.6.220.0100.03020.62
5.6.210.0030.03720.40
5.6.200.0030.04020.56
5.6.190.0000.04320.66
5.6.180.0000.03720.64
5.6.170.0000.04020.66
5.6.160.0030.05720.86
5.6.150.0030.04020.68
5.6.140.0100.07020.64
5.6.130.0100.04320.66
5.6.120.0070.09020.65
5.6.110.0100.07020.58
5.6.100.0030.06020.61
5.6.90.0000.04320.69
5.6.80.0070.07719.96
5.6.70.0200.05720.02
5.6.60.0130.09720.07
5.6.50.0070.05020.09
5.6.40.0030.04019.98
5.6.30.0030.06020.01
5.6.20.0170.07319.93
5.6.10.0100.05719.83
5.6.00.0070.04320.02
5.5.380.0030.03717.63
5.5.370.0070.03717.63
5.5.360.0030.03317.51
5.5.350.0000.03717.48
5.5.340.0030.03318.02
5.5.330.0000.04017.79
5.5.320.0070.03017.88
5.5.310.0030.04317.77
5.5.300.0070.03717.98
5.5.290.0000.04718.02
5.5.280.0070.07018.15
5.5.270.0000.04318.12
5.5.260.0070.04017.88
5.5.250.0030.04717.97
5.5.240.0070.02717.51
5.5.230.0030.04017.54
5.5.220.0100.04717.47
5.5.210.0100.07317.27
5.5.200.0030.03717.34
5.5.190.0000.09017.51
5.5.180.0100.06017.22
5.5.160.0000.04017.48
5.5.150.0070.05017.21
5.5.140.0030.03317.24
5.5.130.0100.03317.19
5.5.120.0030.07717.46
5.5.110.0030.07017.59
5.5.100.0100.03317.09
5.5.90.0030.04017.50
5.5.80.0030.04017.10
5.5.70.0000.04317.49
5.5.60.0200.02717.39
5.5.50.0030.03717.11
5.5.40.0100.04717.25
5.5.30.0000.04017.08
5.5.20.0100.05716.99
5.5.10.0030.03717.10
5.5.00.0030.04017.48
5.4.450.0070.06319.57
5.4.440.0030.06319.36
5.4.430.0030.04019.50
5.4.420.0030.07719.27
5.4.410.0030.07719.30
5.4.400.0030.06018.95
5.4.390.0100.04019.03
5.4.380.0070.05719.25
5.4.370.0170.05019.13
5.4.360.0030.07718.93
5.4.350.0030.05319.10
5.4.340.0000.04319.00
5.4.320.0030.04019.16
5.4.310.0000.05319.03
5.4.300.0070.03719.16
5.4.290.0030.04719.09
5.4.280.0030.07719.18
5.4.270.0070.06719.25
5.4.260.0070.06019.11
5.4.250.0000.04319.00
5.4.240.0030.03319.09
5.4.230.0030.03718.94
5.4.220.0030.05319.10
5.4.210.0030.03719.00
5.4.200.0030.04019.11
5.4.190.0070.07019.11
5.4.180.0100.03018.94
5.4.170.0130.06018.93
5.4.160.0000.04019.16
5.4.150.0030.04719.10
5.4.140.0070.07716.38
5.4.130.0070.06016.25
5.4.120.0070.03716.36
5.4.110.0070.03716.18
5.4.100.0100.03716.29
5.4.90.0000.06016.28
5.4.80.0070.03316.51
5.4.70.0100.06016.39
5.4.60.0030.04316.18
5.4.50.0070.07316.36
5.4.40.0070.06016.37
5.4.30.0000.03716.20
5.4.20.0100.02716.22
5.4.10.0070.06016.45
5.4.00.0030.05015.97
5.3.290.0100.08714.71
5.3.280.0030.03714.70
5.3.270.0100.05714.51
5.3.260.0070.06014.45
5.3.250.0030.04314.50
5.3.240.0030.07014.45
5.3.230.0100.07014.63
5.3.220.0100.06714.45
5.3.210.0070.05314.40
5.3.200.0000.08014.43
5.3.190.0070.08014.52
5.3.180.0030.04014.46
5.3.170.0070.06714.40
5.3.160.0030.03714.45
5.3.150.0030.07014.47
5.3.140.0030.04314.45
5.3.130.0130.05014.57
5.3.120.0070.04014.41
5.3.110.0100.05014.57
5.3.100.0070.04713.93
5.3.90.0130.06014.04
5.3.80.0030.03313.93
5.3.70.0070.06314.10
5.3.60.0130.07014.09
5.3.50.0070.05313.99
5.3.40.0100.06013.80
5.3.30.0070.07713.78
5.3.20.0030.06313.63
5.3.10.0030.03313.72
5.3.00.0070.05713.66
5.2.170.0030.04711.92
5.2.160.0000.03011.92
5.2.150.0000.05711.92
5.2.140.0000.03011.92
5.2.130.0000.03711.92
5.2.120.0030.03311.92
5.2.110.0000.03711.92
5.2.100.0030.05011.92
5.2.90.0000.03011.92
5.2.80.0000.06311.92
5.2.70.0030.05311.92
5.2.60.0000.07011.92
5.2.50.0030.04011.92
5.2.40.0100.05311.92
5.2.30.0070.02311.92
5.2.20.0070.03711.92
5.2.10.0030.03011.92
5.2.00.0000.04311.92
5.1.60.0000.03711.92
5.1.50.0100.03711.92
5.1.40.0000.02311.92
5.1.30.0030.03011.92
5.1.20.0030.02711.92
5.1.10.0070.05311.92
5.1.00.0030.03311.92
5.0.50.0070.03011.92
5.0.40.0000.05011.92
5.0.30.0030.03311.92
5.0.20.0030.01711.92
5.0.10.0030.02011.92
5.0.00.0000.05011.92
4.4.90.0030.01711.92
4.4.80.0000.02311.92
4.4.70.0030.01311.92
4.4.60.0030.03711.92
4.4.50.0000.03711.92
4.4.40.0000.02711.92
4.4.30.0000.02311.92
4.4.20.0000.01711.92
4.4.10.0030.02311.92
4.4.00.0030.04311.92
4.3.110.0030.03711.92
4.3.100.0070.01011.92
4.3.90.0030.04011.92
4.3.80.0000.04711.92
4.3.70.0000.01711.92
4.3.60.0000.02311.92
4.3.50.0000.02711.92
4.3.40.0030.02311.92
4.3.30.0000.03311.92
4.3.20.0000.02011.92
4.3.10.0000.03711.92
4.3.00.0000.04011.92

preferences:
45.12 ms | 401 KiB | 5 Q