php - Hex2bin is not working when I am trying to use it to convert encoded data to binary -
i using bin2hex() function working when tried original value using hex2bin() saying "undefined function". solution?
hex2bin available php version >= 5.4.0 - php version 2 date?
below (copied php.net) solution if version can not updated:
<?php function hextobin($hexstr) { $n = strlen($hexstr); $sbin=""; $i=0; while($i<$n) { $a =substr($hexstr,$i,2); $c = pack("h*",$a); if ($i==0){$sbin=$c;} else {$sbin.=$c;} $i+=2; } return $sbin; } ?>
Comments
Post a Comment