PHP hex2bin() Function
Example
Convert hexadecimal values to ASCII characters:
<?php
echo hex2bin("48656c6c6f20576f726c6421");
?>
Try it Yourself »
Definition and Usage
The hex2bin() function converts a string of hexadecimal values to ASCII characters.
Syntax
hex2bin(string)
Parameter Values
Parameter | Description |
---|---|
string | Required. The hexadecimal value to be converted |
Technical Details
Return Value: | Returns the ASCII character of the converted string, or FALSE on failure |
---|---|
PHP Version: | 5.4.0+ |
Changelog: | PHP 5.5.1 - Throws a warning if the string is invalid hexadecimal string. PHP 5.4.1 - Throws a warning if the string is of odd length. In 5.4.0, the string was silently accepted, but the last byte was removed. |
❮ PHP String Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.