X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP hex2bin() Function

PHP String Reference PHP String Reference

Example

Convert hexadecimal values to ASCII characters:

<?php
echo hex2bin("48656c6c6f20576f726c6421");
?>

The output of the code above will be:

Hello World!


Definition and Usage

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


Syntax

hex2bin(string)

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: As of PHP 5.4.1, a warning is thrown if the string is of odd length. In PHP 5.4.0, the string was silently accepted, but the last byte was removed.

As of PHP 5.5.1, a warning is thrown if the string is invalid hexadecimal string.


PHP String Reference PHP String Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook