How to convert hexadecimal representation of data to binary data in PHP?

前端 未结 3 1707
闹比i
闹比i 2021-01-04 09:35

I\'m familiar with php\'s function bin2hex() for converting binary data to its hexadecimal representation.

However, what is the complement function to c

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-04 09:49

    If you look at PHP's bin2hex page, there's suggested solutions including this one:

    $foo = pack("H*" , $foo);
    echo $foo;
    

    There's also various implementations of hex2bin that you can choose from.

提交回复
热议问题