function hex2bin($data) {
$len = strlen($data);
for($i=0;$i<$len;$i+=2) {
$newdata .= pack("C",hexdec(substr($data,$i,2)));
}
return $newdata;
}
just pass it the hex string and it will return the decoded data:
$coded="68656c6c6f"; $decoded=hex2bin($coded);









Thanks! Works well.