php man page for hex2bin

Query: hex2bin

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

HEX2BIN(3)								 1								HEX2BIN(3)

hex2bin - Decodes a hexadecimally encoded binary string

SYNOPSIS
string hex2bin (string $data)
DESCRIPTION
Decodes a hexadecimally encoded binary string. Caution This function does NOT convert a hexadecimal number to a binary number. This can be done using the base_convert(3) function.
PARAMETERS
o $data - Hexadecimal representation of data.
RETURN VALUES
Returns the binary representation of the given data or FALSE on failure.
ERRORS
/EXCEPTIONS If the hexadecimal input string is of odd length or invalid hexadecimal string an E_WARNING level error is thrown.
CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.5.1 | | | | | | | A warning is thrown if the input string is | | | invalid hexadecimal string. | | | | | 5.4.1 | | | | | | | A warning is thrown if the input string is of | | | odd length. In PHP 5.4.0 the string was silently | | | accepted, but the last byte was truncated. | | | | +--------+---------------------------------------------------+
EXAMPLES
Example #1 hex2bin(3) example <?php $hex = hex2bin("6578616d706c65206865782064617461"); var_dump($hex); ?> The above example will output something similar to: string(16) "example hex data"
SEE ALSO
bin2hex(3), unpack(3). PHP Documentation Group HEX2BIN(3)
Related Man Pages
openssl_random_pseudo_bytes(3) - php
hash(3) - php
dechex(3) - php
sqlite_udf_encode_binary(3) - php
unpack(3) - php
Similar Topics in the Unix Linux Community
Binary and hex in unix
Hex numbering sequence
convert hex to binary and send to variable
Hexadecimal to Binary conversion
Regex and backreference to replace in binary file