gpt4 book ai didi

php - 如何在php5.3中做hex2bin

转载 作者:行者123 更新时间:2023-12-02 15:14:23 30 4
gpt4 key购买 nike

hex2bin() 函数在php5.4以后支持。它在 php5.3 中不可用。我怎样才能在 php3 中执行 hex2bin?

 echo hex2bin("48656c6c6f20576f726c6421");

最佳答案

在 PHP 5.3 中你可以使用 pack

docs

Pack given arguments into a binary string according to format.

string pack ( string $format [, mixed $args [, mixed $... ]] )

所以你要找的是:

$result = pack('H*', '48656c6c6f20576f726c6421');

关于php - 如何在php5.3中做hex2bin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41392968/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com