Convert hexadecimal values to ASCII characters:
<?phpecho hex2bin("48656c6c6f20576f726c6421");?>The above example output results:
Hello World!The hex2bin() function converts a string of hexadecimal values into ASCII characters.
hex2bin( string )
parameter | describe |
---|---|
string | Required. The hexadecimal value to convert. |
Return value: | Returns the ASCII characters of the converted string, or FALSE on failure. |
---|---|
PHP version: | 5.4.0+ |
Update log: | As of PHP 5.4.1, a warning is thrown if the string length is odd. In PHP 5.4.0, odd strings are silently accepted, but the last byte is removed. As of PHP 5.5.1, a warning is thrown if the string is an invalid hexadecimal string. |