sheikh-k
11/15/2016 - 8:51 PM

Compress number into short hash.php

function compressNumber($n) {
    $codeset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $base = strlen($codeset);
    $converted = "";
    while ($n > 0) {
        $converted = substr($codeset, ($n % $base), 1) . $converted;
        $n = floor($n/$base);
    }
    return $converted;
}