Created
August 30, 2019 20:19
-
-
Save 3D-I/d7679f1fb1fa9b6c55d876fa7a9c613b to your computer and use it in GitHub Desktop.
Revisions
-
3D-I created this gist
Aug 30, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ <?php /** * Change get_chunk_size() calculation to correctly calculate limits without * letting a zero "unlimited" value always win. Also ensure get_chunk_size() * can only return zero if all of the limits were in fact set to unlimited. */ $max = 0; $limits = [100, 200, 300]; foreach ($limits as $limit) { if ($limit > 0) { $max = ($max !== 0) ? min($limit, $max) : $limit; } } echo floor($max / 2);