Skip to content

Instantly share code, notes, and snippets.

@pyronaur
Last active May 15, 2017 13:07
Show Gist options
  • Save pyronaur/4c2eed4f9995c9ffe102482b5a551454 to your computer and use it in GitHub Desktop.
Save pyronaur/4c2eed4f9995c9ffe102482b5a551454 to your computer and use it in GitHub Desktop.
Calculate downloads floor
<?php
function download_floor($downloads) {
$length = strlen( $downloads );
$divider = intval( '1' . str_repeat( '0', $length - 1 ) );
return floor( $downloads / $divider ) * $divider;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment