dongmao3148 2014-04-10 12:10
浏览 15
已采纳

php用什么字符表示高基数?

I know that base 16 uses the characters [0-9a-f], and base 36 uses [0-9a-z], but what about base 40? Base 50? Base [arbitrary number]? How does php determine what characters to use for high-base numbers?

  • 写回答

1条回答 默认 最新

  • dpz90118 2014-04-10 12:13
    关注

    PHP won't "determine" symbols for just any arbitrary base. Because base_convert() allows conversions for bases between 2 and 36 only. Thus, it's not allowed to use it for base 50, for example:

    Both frombase and tobase have to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35.

    I assume that it is about base_convert() since only this function has direct relation to the question

    As for base_convert(): internally, it will do _php_math_zvaltobase() call where char map is defined:

    static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作