3v4l.org

run code in 300+ PHP versions simultaneously
<?php function splitItems(array $limits, int $total): array { asort($limits); foreach ($limits as &$limit) { $limit = min($limit, $total); $total -= $limit; } ksort($limits); return $limits; } var_export(splitItems([14, 2], 10)); echo "\n---\n"; var_export(splitItems([6, 8, 2], 14)); echo "\n---\n"; var_export(splitItems([6, 4, 2], 14)); echo "\n---\n"; var_export(splitItems([7, 7, 1], 4)); echo "\n---\n"; var_export(splitItems([1, 1], 10)); echo "\n---\n"; var_export(splitItems([2,1,3],4));

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.0120.00816.58
8.5.00.0070.01320.11
8.4.160.0130.00823.93
8.4.150.0020.00014.05
8.4.140.0130.00817.66
8.4.130.0130.00817.94
8.4.120.0030.00622.35
8.4.110.0100.00822.17
8.4.100.0030.00617.64
8.4.90.0110.00918.56
8.4.80.0100.01019.50
8.4.70.0100.01017.96
8.4.60.0050.00317.99
8.4.50.0110.00918.68
8.4.40.0140.00717.82
8.4.30.0130.00318.78
8.4.20.0160.00321.34
8.4.10.0360.00617.37
8.3.280.0110.01018.59
8.3.270.0120.00816.56
8.3.260.0120.00716.80
8.3.250.0100.00919.01
8.3.240.0090.01016.85
8.3.230.0130.00816.66
8.3.220.0100.00918.88
8.3.210.0060.00216.87
8.3.200.0120.00816.53
8.3.190.0150.00517.21
8.3.180.0070.00719.12
8.3.170.0090.00917.14
8.3.160.0040.01416.85
8.3.150.0180.00017.14
8.3.140.0230.00316.34
8.3.130.0230.00016.45
8.3.120.0180.00316.56
8.3.110.0200.00016.37
8.3.100.0210.00016.23
8.3.90.0140.00616.18
8.3.80.0080.01216.35
8.3.70.0170.00616.69
8.3.60.0180.00316.41
8.3.50.0160.00516.50
8.3.40.0180.00017.20
8.3.30.0110.01117.52
8.3.20.0150.00417.38
8.3.10.0140.00217.50
8.3.00.0110.00017.35
8.2.290.0130.00520.65
8.2.280.0040.00416.89
8.2.270.0130.00617.00
8.2.260.0170.00716.53
8.2.250.0140.00416.63
8.2.240.0180.00016.59
8.2.230.0150.00316.75
8.2.220.0120.00816.24
8.2.210.0130.00716.45
8.2.200.0170.00016.46
8.2.190.0140.00316.63
8.2.180.0180.00316.44
8.2.170.0150.00317.48
8.2.160.0150.00417.40
8.2.150.0170.00017.75
8.2.140.0130.00517.41
8.2.130.0160.00317.63
8.2.120.0140.00417.53
8.2.110.0070.01117.09
8.2.100.0140.00517.53
8.2.90.0110.00717.47
8.2.80.0080.01117.36
8.2.70.0070.01017.36
8.2.60.0140.00517.57
8.2.50.0170.00017.49
8.2.40.0140.00317.82
8.2.30.0080.00817.34
8.2.20.0110.00517.48
8.2.10.0140.00217.46
8.2.00.0170.00017.32
8.1.320.0110.00717.87

preferences:
60.85 ms | 403 KiB | 5 Q