String Functions
PHP Manual

hex2bin

(No version information available, might only be in SVN)

hex2binConvert hex to binary

Description

string hex2bin ( string $data )

Converts the hex representation of data to binary

Parameters

data

Hexadecimal representation of data.

Return Values

Returns the binary representation of the given data.

Examples

Example #1 hex2bin() example

<?php
$hex 
hex2bin("6578616d706c65206865782064617461");
var_dump($hex);
?>

The above example will output something similar to:

string(16) "example hex data"

See Also


String Functions
PHP Manual