Tác dụng của hàm hex2bin()
The hex2bin()
function decodes a hexadecimally encoded binary string.
The following table summarizes the technical details of this function.
Return Value: | Returns the binary representation of the given data or FALSE on failure. |
---|---|
Version: | PHP 5.4.0+ |
Syntax
The basic syntax of the hex2bin()
function is given with:
hex2bin(string);
The following example shows the hex2bin()
function in action.
Ví dụ
<?php
// Decoding a hexadecimally encoded binary string
echo hex2bin("48656c6c6f20576f726c6421");
?>
Note: The hex2bin()
function does not convert a hexadecimal number to a binary number. This can be done using the base_convert()
function.
Parameters
The hex2bin()
function accepts the following parameters.
Parameter | Description |
---|---|
string | Required. Specifies the hexadecimal representation of data. |