Created
April 8, 2015 13:40
-
-
Save walterdavis/6b8284044c4a85ee994e to your computer and use it in GitHub Desktop.
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 characters
<?php | |
$rows = 106; | |
function seek_row_count($rows, $target = 35){ | |
$result = $rows % $target; | |
if($result == 0 || $result > 1) return $target; | |
return seek_row_count($rows, --$target); | |
} | |
print seek_row_count($rows, 35); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using tail-call recursion to split a large collection into a set of slices without any widows at the end.