Skip to content

Instantly share code, notes, and snippets.

@3D-I 3D-I/chunck_size.php
Created Aug 30, 2019

Embed
What would you like to do?
<?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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.