- hex2bin: documentation ( source)
- bin2hex: documentation ( source)
- chr: documentation ( source)
- hexdec: documentation ( source)
<?php
function XXhex2bin($h)
{
if (!is_string($h)) return null;
$r='';
for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
return $r;
}
$encoded = bin2hex('ijok');
echo hex2bin($encoded);
?>