src/Base62.php
public function encode($value, $b = 62)
    {
        $r = (int) $value % $b;
        $result = $this->base[$r];
        $q = floor((int) $value / $b);

        while ($q) {
            $r = $q % $b;
            $q = floor($q / $b);
            $result = $this->base[$r].$result;
        }

        return $result;
    }
public function encode($value, $b = 62)
    {
        $r = (int) $value % $b;
        $result = $this->base[$r];
        $q = floor((int) $value / $b);

        while ($q) {
            $r = $q % $b;
            $q = floor($q / $b);
            $result = $this->base[$r].$result;
        }

        return $result;
    }
Encode an integer to a string.

@param int $value
@param int $b

@return string