3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sortAvg($array){ $a = array_slice($array, 0); $avg = array_sum($a)/count($a); echo $avg . "\n"; uasort($a, function($o, $b) use($avg){ return abs($o-$avg) > abs($b-$avg); }); return $a; } $array = [ 'A' => 50, 'B' => 155, 'C' => 75, 'D' => 245, 'E' => 300, 'F' => 100, 'G' => 153, ]; $results = sortAvg($array); $closestKey = array_keys($results)[0]; $closestValue = $results[$closestKey]; var_export([$closestKey, $closestValue]);

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.0070.01016.79
8.5.00.0200.00720.11
8.4.150.0030.00014.05
8.4.140.0080.01317.47
8.4.130.0100.01217.58
8.4.120.0150.00424.27
8.4.110.0120.00618.24
8.4.100.0120.00819.01
8.4.90.0080.00419.06
8.4.80.0120.00818.73
8.4.70.0130.00618.05
8.4.60.0050.00618.71
8.4.50.0120.00918.91
8.4.40.0110.00717.80
8.4.30.0150.00020.43
8.4.20.0130.00617.99
8.4.10.0130.00619.78
8.3.280.0080.01218.68
8.3.270.0130.00816.82
8.3.260.0090.00916.54
8.3.250.0110.00918.80
8.3.240.0130.00818.99
8.3.230.0080.01116.64
8.3.220.0130.00519.06
8.3.210.0050.00316.57
8.3.200.0070.00216.69
8.3.190.0040.00517.33
8.3.180.0130.00617.02
8.3.170.0140.00420.68
8.3.160.0090.00917.24
8.3.150.0030.01217.09
8.3.140.0110.00716.57
8.3.130.0030.01316.70
8.3.120.0100.00018.63
8.3.110.0080.00016.90
8.3.100.0160.00020.47
8.3.90.0080.00026.77
8.3.80.0030.00619.36
8.3.70.0040.01118.55
8.3.60.0090.01318.56
8.3.50.0100.01024.40
8.3.40.0070.00718.92
8.3.30.0090.00618.83
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0050.00326.16
8.2.290.0130.00520.35
8.2.280.0090.00918.39
8.2.270.0100.01017.09
8.2.260.0110.00716.54
8.2.250.0070.00317.00
8.2.240.0000.00816.78
8.2.230.0090.00020.94
8.2.220.0100.00024.06
8.2.210.0080.00026.77
8.2.200.0060.00318.88
8.2.190.0130.01018.54
8.2.180.0120.00925.92
8.2.170.0130.00619.04
8.2.160.0130.00622.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0050.00326.35
8.2.110.0000.01022.08
8.2.100.0110.00017.84
8.2.90.0080.00519.04
8.2.80.0040.00417.97
8.2.70.0030.00517.75
8.2.60.0080.00018.03
8.2.50.0060.00318.07
8.2.40.0000.00918.15
8.2.30.0050.00318.14
8.2.20.0040.00418.02
8.2.10.0060.00319.29
8.2.00.0040.00419.24
8.1.330.0110.00822.03
8.1.320.0070.01218.58
8.1.310.0080.00018.55
8.1.300.0040.01218.05
8.1.290.0030.00630.84
8.1.280.0120.00325.92
8.1.270.0040.00423.99
8.1.260.0040.00428.09
8.1.250.0070.00028.09
8.1.240.0030.00720.81
8.1.230.0040.00921.03
8.1.220.0000.00817.77
8.1.210.0000.00918.77
8.1.200.0070.00317.35
8.1.190.0040.00417.35
8.1.180.0030.00618.10
8.1.170.0050.00318.70
8.1.160.0000.00718.82
8.1.150.0040.00418.95
8.1.140.0000.00818.91
8.1.130.0040.00420.19
8.1.120.0000.00717.51
8.1.110.0000.00817.36
8.1.100.0050.00317.40
8.1.90.0040.00417.49
8.1.80.0050.00317.40
8.1.70.0040.00417.38
8.1.60.0000.00817.64
8.1.50.0000.00817.60
8.1.40.0000.00817.50
8.1.30.0080.00417.64
8.1.20.0060.00317.57
8.1.10.0080.00017.60
8.1.00.0040.00417.55
8.0.300.0000.00718.77
8.0.290.0000.00916.75
8.0.280.0030.00318.42
8.0.270.0000.00717.95
8.0.260.0000.00618.38
8.0.250.0070.00016.95
8.0.240.0070.00016.98
8.0.230.0080.00016.91
8.0.220.0050.00316.94
8.0.210.0030.00316.84
8.0.200.0030.00317.06
8.0.190.0030.00617.09
8.0.180.0030.00517.01
8.0.170.0030.00517.04
8.0.160.0070.00017.07
8.0.150.0000.00816.92
8.0.140.0070.00016.93
8.0.130.0030.00313.39
8.0.120.0030.00616.86
8.0.110.0040.00416.89
8.0.100.0040.00417.03
8.0.90.0000.00717.08
8.0.80.0080.00716.95
8.0.70.0040.00417.00
8.0.60.0050.00317.07
8.0.50.0000.00716.76
8.0.30.0130.00317.19
8.0.20.0090.00917.04
8.0.10.0150.00316.96
8.0.00.0110.00916.96
7.4.330.0050.00015.55
7.4.320.0060.00016.50
7.4.300.0060.00016.50
7.4.290.0050.00316.55
7.4.280.0000.00716.61
7.4.270.0000.00816.63
7.4.260.0030.00313.28
7.4.250.0080.00016.58
7.4.240.0020.00516.60
7.4.230.0000.00616.59
7.4.220.0050.00316.44
7.4.210.0070.00816.50
7.4.200.0000.00716.61
7.4.150.0040.01416.24
7.4.140.0160.00415.94
7.4.130.0060.01216.68
7.4.120.0070.01516.55
7.4.110.0070.01016.47
7.4.100.0070.01416.34
7.4.90.0160.00316.48
7.4.80.0120.00616.53
7.4.70.0110.00616.46
7.4.60.0130.00316.39
7.4.50.0100.00716.40
7.4.40.0110.00716.42
7.4.30.0140.00316.50
7.4.20.0140.00316.63
7.4.10.0110.00716.63
7.4.00.0150.00316.56
7.3.330.0000.00716.30
7.3.320.0000.00613.40
7.3.310.0070.00016.28
7.3.300.0030.00316.33
7.3.290.0060.00716.38
7.3.270.0060.01216.38
7.3.260.0060.01216.44
7.3.250.0140.00316.57
7.3.240.0040.01416.47
7.3.230.0160.00316.53
7.3.220.0090.00916.45
7.3.210.0090.00916.55
7.3.200.0060.01216.55
7.3.190.0080.00816.52
7.3.180.0060.01116.64
7.3.170.0070.01016.36
7.3.160.0120.00616.64
7.3.150.0110.00616.34
7.3.140.0120.00616.50
7.3.130.0150.00416.54
7.3.120.0100.00716.27
7.3.110.0110.00716.23
7.3.100.0110.00716.29
7.3.90.0070.01216.65
7.3.80.0120.00616.34
7.3.70.0140.00416.39
7.3.60.0130.00716.52
7.3.50.0160.00816.48
7.3.40.0080.00816.56
7.3.30.0100.00716.52
7.3.20.0110.00716.20
7.3.10.0070.01016.25
7.3.00.0090.01016.38

preferences:
172.28 ms | 403 KiB | 5 Q