public static function baseFromDec($input, $Chars)
    {
        if (preg_match('/^[0-9]+$/', $input))
        {
            $Result = '';
            do
            {
                $Result .= $Chars[bcmod($input, strlen($Chars))];
                $input = bcdiv($input, strlen($Chars), 0);
            }
            while (bccomp($input, '0') != 0);

            return strrev($Result);
        }
        return false;
    }