hex2bin()

The hex2bin() function converts a string of hexadecimal values to its binary representation.

Note: This function does NOT convert a hexadecimal number to a binary number. The hex2bin() function is available only in PHP 5.4.0 and later versions.

Syntax

hex2bin(hex_string);

The hex_string parameter represents the string of hexadecimal values to be converted.

Codebyte Example

The following example shows how to use the hex2bin() function:

Code
Output
Loading...

All contributors

Looking to contribute?

Learn PHP on Codecademy