hex2bin() function is supported after php5.4. It is not available in php5.3. How can I do hex2bin in php3 ?
echo hex2bin("48656c6c6f20576f726c6421");
In PHP 5.3 you can use pack
docs
Pack given arguments into a binary string according to format.
string pack ( string $format [, mixed $args [, mixed $... ]] )
So you're looking for:
$result = pack('H*', '48656c6c6f20576f726c6421');
Just use
$foo = pack("H*" ,"48656c6c6f20576f726c6421");
echo $foo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With