3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [6,4,9,3,8,2,1,5]; // Calculate the total of the array elements $sum = array_sum($arr); $len = count($arr); // Using integer division and modulo arithmetic calculate the average and remainder $avg = intdiv($sum,$len); $rem = $sum % $len; // Create a result array and fill with the average $result = array_fill(0,$len,$avg); // Spread the remainder over the first few elements. while($rem){$result[--$rem]++;} var_dump($result); ?>

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.60.0110.00716.69
8.5.50.0040.00316.67
8.5.30.0100.00720.25
8.5.20.0100.00819.49
8.5.10.0080.00920.59
8.5.00.0140.01119.93
8.4.210.0100.00921.35
8.4.180.0130.01019.61
8.4.170.0120.00923.87
8.4.160.0110.01223.88
8.4.150.0080.00416.86
8.4.140.0160.00817.36
8.4.130.0050.00517.85
8.4.120.0040.00420.61
8.4.110.0110.00522.28
8.4.100.0130.00817.63
8.4.90.0110.00918.57
8.4.80.0020.00618.77
8.4.70.0110.00917.64
8.4.60.0050.00418.68
8.4.50.0120.01017.66
8.4.40.0060.01519.34
8.4.30.0160.00320.59
8.4.20.0030.00619.55
8.4.10.0120.00424.10
8.3.300.0150.00620.73
8.3.290.0130.00820.81
8.3.280.0090.01118.23
8.3.270.0080.01116.65
8.3.260.0110.00816.33
8.3.250.0100.00618.78
8.3.240.0080.01116.50
8.3.230.0110.00116.70
8.3.220.0050.00319.14
8.3.210.0100.00816.77
8.3.200.0040.00516.52
8.3.190.0060.00518.87
8.3.180.0110.00116.60
8.3.170.0100.00019.29
8.3.160.0120.00618.56
8.3.150.0080.00019.07
8.3.140.0110.00418.99
8.3.130.0030.00618.43
8.3.120.0120.00820.66
8.3.110.0040.00420.94
8.3.100.0090.00024.06
8.3.90.0050.00326.77
8.3.80.0060.00318.56
8.3.70.0150.00716.58
8.3.60.0090.00618.30
8.3.50.0170.00318.29
8.3.40.0000.01618.76
8.3.30.0150.00419.14
8.3.20.0000.00724.18
8.3.10.0000.00824.66
8.3.00.0080.00026.16
8.2.300.0130.00820.21
8.2.290.0120.00420.18
8.2.280.0030.00520.36
8.2.270.0110.00717.31
8.2.260.0050.00318.53
8.2.250.0000.00816.58
8.2.240.0060.00319.13
8.2.230.0030.00622.58
8.2.220.0080.00037.54
8.2.210.0080.00026.77
8.2.200.0070.00316.63
8.2.190.0090.00916.63
8.2.180.0090.00625.92
8.2.170.0080.00618.96
8.2.160.0070.00722.96
8.2.150.0070.00025.66
8.2.140.0000.00724.66
8.2.130.0070.00026.16
8.2.120.0030.00620.46
8.2.110.0070.00420.98
8.2.100.0090.00317.78
8.2.90.0030.00719.64
8.2.80.0000.00918.06
8.2.70.0030.00517.50
8.2.60.0030.00517.48
8.2.50.0030.00617.98
8.2.40.0000.01018.28
8.2.30.0040.00418.10
8.2.20.0000.00720.41
8.2.10.0040.00417.98
8.2.00.0000.00819.21
8.1.340.0110.00817.46
8.1.330.0100.00921.80
8.1.320.0110.00816.15
8.1.310.0040.00418.34
8.1.300.0140.00417.98
8.1.290.0120.00630.84
8.1.280.0100.00325.92
8.1.270.0030.00523.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.84
8.1.230.0000.01120.89
8.1.220.0000.00817.77
8.1.210.0080.00018.78
8.1.200.0000.00917.23
8.1.190.0000.00917.22
8.1.180.0000.00818.10
8.1.170.0000.00917.62
8.1.160.0000.00718.82
8.1.150.0050.00218.50
8.1.140.0030.00517.36
8.1.130.0000.00718.86
8.1.120.0000.00817.45
8.1.110.0000.00817.52
8.1.100.0000.00717.38
8.1.90.0000.00717.50
8.1.80.0040.00417.45
8.1.70.0000.00717.33
8.1.60.0050.01017.51
8.1.50.0090.00917.31
8.1.40.0120.00417.39
8.1.30.0000.01217.46
8.1.20.0080.00417.54
8.1.10.0180.00317.44
8.1.00.0130.00317.29
8.0.300.0000.00719.98
8.0.290.0040.00416.75
8.0.280.0000.00818.50
8.0.270.0030.00316.80
8.0.260.0060.00018.44
8.0.250.0040.00416.82
8.0.240.0000.00716.84
8.0.230.0030.00316.96
8.0.220.0030.00316.72
8.0.210.0030.00316.89
8.0.200.0030.00316.91
8.0.190.0110.00016.79
8.0.180.0080.00316.68
8.0.170.0040.00816.78
8.0.160.0150.00016.77
8.0.150.0120.00416.79
8.0.140.0070.00716.78
8.0.130.0080.00816.91
8.0.120.0120.00416.83
8.0.110.0110.00016.74
8.0.100.0060.00616.77
8.0.90.0100.00016.82
8.0.80.0040.01116.93
8.0.70.0130.00416.79
8.0.60.0050.00916.89
8.0.50.0100.00616.83
8.0.30.0180.00016.68
8.0.20.0180.00016.90
8.0.10.0140.00316.84
7.4.330.0000.00515.55
7.4.320.0030.00316.59
7.4.300.0030.00316.61
7.4.290.0080.00916.48
7.4.280.0130.00316.55
7.4.270.0120.00516.53
7.4.260.0130.00416.57
7.4.250.0120.00416.35
7.4.240.0130.00616.56
7.4.230.0140.00416.47
7.4.220.0120.00416.50
7.4.210.0110.00616.48
7.4.200.0130.00316.58
7.4.190.0100.00716.52
7.4.180.0100.00716.54
7.4.160.0130.00316.66
7.4.150.0160.00016.39
7.4.140.0160.00016.28
7.4.130.0090.00616.33
7.4.120.0090.00316.30
7.4.110.0080.00416.39
7.4.100.0040.00416.37
7.4.90.0050.00516.43
7.4.80.0030.00616.18
7.4.70.0100.00016.38
7.4.60.0080.00016.34
7.4.50.0110.00216.41
7.4.40.0120.00316.35
7.4.30.0110.00016.40
7.4.20.0050.00516.31
7.4.10.0030.00716.24
7.4.00.0060.00416.36

preferences:
91.2 ms | 1272 KiB | 5 Q