PHP Tutorial - PHP hex2bin() Function






Definition

The hex2bin() function decodes a hexadecimally encoded binary string.

Syntax

PHP hex2bin() Function has the following syntax.

hex2bin(string)

Parameter

Parameter Is Required Description
stringRequired.The hexadecimal value to be converted

Return

PHP hex2bin() Function returns the encoded binary string, or FALSE on failure.

Example

decodes a hexadecimally encoded binary string:


<?php
echo hex2bin("1231FFF23123");
?>