function dirRange($n) { $qtdDigitos = 7; //004820 $qtdRange = 500; $result = floor($n / $qtdRange); $de = preencherZeros(($result * $qtdRange) + 1, $qtdDigitos); $ate = preencherZeros(($result * $qtdRange) + $qtdRange, $qtdDigitos); $string = "{$de}-{$ate}"; return $string . '/' . $n . '/'; } function preencherZeros($n, $qtd) { $r = str_repeat("0", $qtd - strlen($n)) . $n; return $r; } ?>