Easy Tutorial
❮ Func Mysqli Kill Func Misc Connection Status ❯

PHP hex2bin() Function

PHP String Reference Manual

Example

Convert hexadecimal value to ASCII characters:

The above example outputs:


Definition and Usage

The hex2bin() function converts a string of hexadecimal values to ASCII characters.


Syntax

Parameter Description
string Required. The hexadecimal value to convert.

Technical Details

Return Value: Returns the ASCII characters of the converted string, or FALSE on failure.
PHP Version: 5.4.0+
--- ---
Update Log: Since PHP 5.4.1, a warning is thrown if the string length is odd. In PHP 5.4.0, odd-length strings were silently accepted, but the last byte was removed. <br> <br>Since PHP 5.5.1, a warning is thrown if the string is an invalid hexadecimal string.
--- ---
❮ Func Mysqli Kill Func Misc Connection Status ❯