hex2bin(3) php man page | unix.com

Man Page: hex2bin

Operating Environment: php

Section: 3

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
phar.setstub(3) - php
openssl_encrypt(3) - php
hexdec(3) - php
gmp_init(3) - php
unpack(3) - php
Similar Topics in the Unix Linux Community
Binary and hex in unix
hex data conversion
ascii to hex
How to find length of string and pass into char array in C?
how to get data from hex file using SED or AWK based on pattern sign