3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "Jacob" => 5, "bob" => 20, "John" => 10, "Jane" => 20, "Jill" => 15, ]; $limit = 3; arsort($array); $result = []; foreach ($array as $k => $v) { if (count($result) === $limit && !isset($result[$v])) { break; } $result[$v][$k] = $v; } var_export(array_values($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.30.0100.00819.48
8.5.20.0070.01020.25
8.5.10.0060.00216.86
8.5.00.0120.00819.97
8.4.180.0160.00622.10
8.4.170.0130.00924.05
8.4.160.0090.01123.96
8.4.150.0080.00416.85
8.4.140.0100.01117.64
8.4.130.0110.00918.75
8.4.120.0120.00823.80
8.4.110.0050.00618.81
8.4.100.0050.00417.92
8.4.90.0100.00618.87
8.4.80.0100.01017.69
8.4.70.0120.00817.82
8.4.60.0110.00518.66
8.4.50.0130.00618.78
8.4.40.0100.01017.83
8.4.30.0120.00620.40
8.4.20.0190.00321.28
8.4.10.0000.00919.36
8.3.300.0150.00820.73
8.3.290.0150.00518.47
8.3.280.0100.00918.53
8.3.270.0100.00916.69
8.3.260.0040.00416.80
8.3.250.0120.00618.86
8.3.240.0120.00717.16
8.3.230.0110.00716.87
8.3.220.0090.00818.57
8.3.210.0050.00318.38
8.3.200.0050.00416.54
8.3.190.0120.00617.14
8.3.180.0100.00616.65
8.3.170.0070.01117.42
8.3.160.0080.00020.89
8.3.150.0070.01117.25
8.3.140.0120.00616.78
8.3.130.0330.00916.72
8.3.120.0260.01116.59
8.3.110.0360.00616.55
8.3.100.0390.00816.55
8.3.90.0390.00816.48
8.3.80.0330.01316.88
8.3.70.0330.00716.62
8.3.60.0380.01316.63
8.3.50.0300.01516.41
8.3.40.0370.00317.33
8.3.30.0270.00917.47
8.3.20.0270.01017.53
8.3.10.0220.01517.38
8.3.00.0140.01117.38
8.2.300.0160.00518.85
8.2.290.0100.00920.38
8.2.280.0130.00718.37
8.2.270.0160.00316.61
8.2.260.0030.00517.29
8.2.250.0290.00716.52
8.2.240.0190.01616.19
8.2.230.0230.01216.50
8.2.220.0150.00416.50
8.2.210.0140.00416.72
8.2.200.0110.00716.44
8.2.190.0260.00616.43
8.2.180.0320.00316.52
8.2.170.0350.00317.70
8.2.160.0360.00717.64
8.2.150.0330.01217.34
8.2.140.0390.00317.55
8.2.130.0310.01017.31
8.2.120.0450.00017.47
8.2.110.0350.00017.64
8.2.100.0220.00417.62
8.2.90.0370.00417.61
8.2.80.0310.00417.53
8.2.70.0350.00417.57
8.2.60.0360.00417.65
8.2.50.0250.01117.75
8.2.40.0220.00917.40
8.2.30.0250.01017.48
8.2.20.0450.01017.32
8.2.10.0350.00317.51
8.2.00.0250.01217.49
8.1.340.0080.01117.61
8.1.330.0120.00721.64
8.1.320.0110.00716.32
8.1.310.0090.00916.55
8.1.300.0300.01216.26
8.1.290.0370.00316.23
8.1.280.0350.01016.18
8.1.270.0380.00317.21
8.1.260.0280.00317.51
8.1.250.0350.00917.45
8.1.240.0280.00817.27
8.1.230.0270.00917.26
8.1.220.0280.00917.24
8.1.210.0330.00717.39
8.1.200.0270.01317.19
8.1.190.0340.00317.29
8.1.180.0430.00017.27
8.1.170.0340.00817.25
8.1.160.0340.00717.29
8.1.150.0340.00617.14
8.1.140.0360.00417.13
8.1.130.0240.01216.97
8.1.120.0310.00817.31
8.1.110.0290.01017.33
8.1.100.0290.01117.32
8.1.90.0230.01317.20
8.1.80.0320.00317.20
8.1.70.0220.01517.19
8.1.60.0390.00017.39
8.1.50.0400.00717.48
8.1.40.0450.00317.48
8.1.30.0340.00517.33
8.1.20.0240.02017.46
8.1.10.0430.00317.46
8.1.00.0260.01517.25

preferences:
55.28 ms | 994 KiB | 5 Q