php 是否有内置的 base32 值转换?

发布于 2024-08-13 17:11:47 字数 106 浏览 11 评论 0原文

我知道我可以使用 number_format,但是有没有办法表示 base32 数字?例如,十六进制可以用0x...来表示,八进制可以用前面的0来表示。 php中有什么可以表示base32数字的吗?

I know I can use number_format, but is there a way to represent base32 numbers? For example, hex can be represented with 0x... and octal can be represented with a 0 in the front. Is there anything to represent base32 numbers in php?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故人的歌 2024-08-20 17:11:47

使用内置函数base_convert。例如:

// To convert from base 10 to base 32:
echo( base_convert( 12345, 10, 32 ) );

Use the built-in function base_convert. For example:

// To convert from base 10 to base 32:
echo( base_convert( 12345, 10, 32 ) );
走走停停 2024-08-20 17:11:47

我从未见过 Base32 的原生表示法,但当然有 Base_convert( )

I never seen a native notation for base32, but there is ofcourse Base_convert() .

红墙和绿瓦 2024-08-20 17:11:47

number_format() 不能用于“表示”基数 32 数字,我想知道您是否是指 base_convert (http://php.net/base_convert) 在基数之间移动,例如

echo(base_convert('FF', 16, 10));

至于使用特殊前缀定义它们,据我所知 PHP 仅支持 0 和 0x对于八进制/十六进制。

number_format() cannot be used to 'represent' a base 32 number, I wonder if you mean base_convert (http://php.net/base_convert) to move between bases, e.g.

echo(base_convert('FF', 16, 10));

As for defining them with a special prefix, as far as I'm aware PHP only supports 0 and 0x for octal/hexadecimal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文