3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'water' => [0, 1, 2, 3, 4, 5], 'apple' => [1, 5, 3, 4, 0, 0], 'beer' => [0, 0, 0, 0, 0, 0] ]; $arrWeight = array_map(function($value) { return is_array($value) ? array_sum($value) : 0; }, $arr); arsort($arrWeight); $arrAllowedKeys = array_slice($arrWeight, 0, 2, true); $arr = array_intersect_key($arr, $arrAllowedKeys); var_export($arr);

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.4.120.0110.00824.02
8.4.110.0070.00218.94
8.4.100.0130.00817.53
8.4.90.0110.00820.39
8.4.80.0140.00618.91
8.4.70.0050.00419.06
8.4.60.0100.00718.92
8.4.50.0100.01020.22
8.4.40.0060.00317.55
8.4.30.0030.01720.35
8.4.20.0070.01318.08
8.4.10.0080.00025.96
8.3.250.0120.00718.95
8.3.240.0080.01217.28
8.3.230.0110.00916.56
8.3.220.0110.00618.98
8.3.210.0120.00616.50
8.3.200.0030.00516.47
8.3.190.0090.01017.13
8.3.180.0090.00716.55
8.3.170.0120.00616.92
8.3.160.0090.00918.57
8.3.150.0040.01420.58
8.3.140.0120.00616.91
8.3.130.0080.00018.28
8.3.120.0080.00020.91
8.3.110.0030.00520.94
8.3.100.0090.00924.06
8.3.90.0090.00926.77
8.3.80.0060.00316.38
8.3.70.0090.00916.58
8.3.60.0100.01016.75
8.3.50.0120.00823.59
8.3.40.0070.00718.54
8.3.30.0070.00718.51
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0000.00726.16
8.2.290.0130.00620.35
8.2.280.0100.00718.31
8.2.270.0030.00717.43
8.2.260.0040.01116.54
8.2.250.0030.00616.42
8.2.240.0000.00817.26
8.2.230.0030.00522.58
8.2.220.0030.00637.54
8.2.210.0000.01026.77
8.2.200.0060.00316.50
8.2.190.0100.00716.58
8.2.180.0180.00025.92
8.2.170.0100.01018.96
8.2.160.0030.01022.96
8.2.150.0000.00925.66
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0060.00326.35
8.2.110.0060.00320.51
8.2.100.0070.00417.66
8.2.90.0090.00017.88
8.2.80.0100.00018.73
8.2.70.0030.00617.50
8.2.60.0000.00817.93
8.2.50.0000.01018.05
8.2.40.0070.00018.22
8.2.30.0090.00318.13
8.2.20.0000.01118.07
8.2.10.0040.00419.26
8.2.00.0000.00719.18
8.1.330.0110.00821.78
8.1.320.0070.01116.05
8.1.310.0040.00420.00
8.1.300.0030.00619.95
8.1.290.0060.00318.88
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0050.00328.09
8.1.250.0080.00028.09
8.1.240.0070.01123.78
8.1.230.0110.00020.93
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0040.00417.35
8.1.190.0050.00517.35
8.1.180.0040.00418.10
8.1.170.0000.00818.68
8.1.160.0040.00418.80
8.1.150.0030.00618.84
8.1.140.0000.00718.85
8.1.130.0040.00420.14
8.1.120.0000.00717.49
8.1.110.0040.00417.44
8.1.100.0060.00317.33
8.1.90.0040.00417.36
8.1.80.0120.00017.52
8.1.70.0070.00017.46
8.1.60.0040.00417.60
8.1.50.0000.00817.41
8.1.40.0080.00017.53
8.1.30.0030.00617.50
8.1.20.0050.00317.57
8.1.10.0060.00317.48
8.1.00.0000.00817.39
8.0.300.0000.00718.77
8.0.290.0000.00716.63
8.0.280.0030.00318.25
8.0.270.0000.00717.86
8.0.260.0000.00618.38
8.0.250.0030.00616.80
8.0.240.0040.00416.86
8.0.230.0070.00016.89
8.0.220.0040.00416.71
8.0.210.0000.00716.79
8.0.200.0030.00316.95
8.0.190.0000.00716.84
8.0.180.0040.00416.87
8.0.170.0060.00316.91
8.0.160.0000.00716.89
8.0.150.0020.00516.86
8.0.140.0070.00016.74
8.0.130.0030.00313.36
8.0.120.0050.00316.82
8.0.110.0070.00016.90
8.0.100.0000.00816.95
8.0.90.0000.00716.95
8.0.80.0080.00816.86
8.0.70.0040.00416.71
8.0.60.0050.00216.71
8.0.50.0040.00416.92
8.0.30.0040.01316.99
8.0.20.0100.00716.99
8.0.10.0130.00617.00
8.0.00.0060.01517.23
7.4.330.0000.00515.55
7.4.320.0070.00016.53
7.4.300.0000.00716.65
7.4.290.0040.00416.35
7.4.280.0000.01216.48
7.4.270.0000.00716.52
7.4.260.0060.00013.35
7.4.250.0040.00416.34
7.4.240.0000.00716.36
7.4.230.0040.00416.53
7.4.220.0040.00416.40
7.4.210.0100.00816.57
7.4.200.0070.00016.45
7.4.140.0110.00716.38
7.4.130.0100.01016.45
7.4.120.0080.00916.33
7.4.110.0140.01416.63
7.4.100.0110.00716.45
7.4.90.0130.00916.51
7.4.80.0100.00716.46
7.4.70.0110.00516.55
7.4.60.0090.00916.41
7.4.50.0120.00616.52
7.4.40.0120.00616.35
7.4.30.0120.00616.49
7.4.20.0170.00016.45
7.4.10.0030.02116.38
7.4.00.0070.01116.44
7.3.330.0040.00416.28
7.3.320.0030.00313.06
7.3.310.0040.00416.25
7.3.300.0030.00316.09
7.3.290.0100.00516.25
7.3.260.0140.00316.42
7.3.250.0160.00316.25
7.3.240.0090.00916.45
7.3.230.0130.01016.54
7.3.220.0090.00916.35
7.3.210.0090.00916.16
7.3.200.0030.01416.23
7.3.190.0070.01016.57
7.3.180.0030.01416.36
7.3.170.0100.00716.31
7.3.160.0200.00316.38
7.3.150.0130.00316.46
7.3.140.0140.00316.14
7.3.130.0120.00616.35
7.3.120.0050.01816.21
7.3.110.0120.01216.25
7.3.100.0120.01216.16
7.3.90.0140.00416.24
7.3.80.0130.00716.23
7.3.70.0090.00916.38
7.3.60.0080.01216.42
7.3.50.0100.01016.26
7.3.40.0150.00616.35
7.3.30.0090.01216.47
7.3.20.0090.01316.27
7.3.10.0130.01316.20
7.3.00.0110.01516.22

preferences:
28.67 ms | 403 KiB | 5 Q