Created
October 12, 2013 03:37
-
-
Save azcdev/6945514 to your computer and use it in GitHub Desktop.
funcion hex2bin introducida en PHP 5.4, pero no disponible en versiones inferiores.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hex2bin($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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment