* ** Convert 10 to 62 in hexadecimal order ** @ paraminteger $ n10 in hexadecimal order * @ returnstring62 in hexadecimal order * functiondec62 ($ n) {$ base = 62; $ index = & amp; 39; 0123456789
/*** Convert 10 to 62 in hexadecimal format ** @ param integer $ n 10 in hexadecimal value * @ return string 62 in hexadecimal format */function dec62 ($ n) {$ base = 62; $ index = 'hangzhou'; $ ret = ''; for ($ t = floor (log10 ($ n)/log10 ($ base )); $ t> = 0; $ t --) {$ a = floor ($ n/pow ($ base, $ t); $ ret. = substr ($ index, $ a, 1); $ n-= $ a * pow ($ base, $ t);} return $ ret ;}
/*** Convert from 62 to 10 ** @ param integer $ n 62 * @ return string 10 */function dec10 ($ s) {$ base = 62; $ index = '0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz '; $ ret = 0; $ len = strlen ($ s)-1; for ($ t = 0; $ t <= $ len; $ t ++) {$ ret + = strpos ($ index, substr ($ s, $ t, 1) * pow ($ base, $ len-$ t);} return $ ret;