PHP.nl

hex2bin

hex2bin

Decodes a hexadecimally encoded binary string

 **hex2bin** string $string

Decodes a hexadecimally encoded binary string.

Let op: > This function does convert a hexadecimal number to a binary number. This can be done using the function. NOTbase_convert

stringHexadecimal representation of data.

Returns the binary representation of the given data return.falseforfailure.

If the hexadecimal input string is of odd length or invalid hexadecimal string an level error is thrown. E_WARNING

Voorbeeld: example

<?php
$hex = hex2bin("6578616d706c65206865782064617461");
var_dump($hex);
?>
string(16) "example hex data"

bin2hex``unpack