function _hexstring($bin)
{
list(,$ret) = unpack('h1', $bin);
return($ret);
}
I'm missing something fundamental here. It returns a blank string.
Anybody have an idea?
~BenDilts( void );
[web] unpack: Binary string to hex string (PHP)
I'm trying to use the unpack function in PHP to convert a text or binary string to its hexadecimal representation (e.g. 'hello' -> '68656c6c6f')
Try:
function _hexstring($bin){ list(,$ret) = unpack('H'.strlen($bin)*2, $bin); return($ret);}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement