Hướng dẫn
Quảng cáo

Hàm hex2bin() trong PHP

Hướng dẫn cách sử dụng hàm hex2bin() trong lập trình PHP

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.

 

Bài viết này đã giúp ích cho bạn?

Bài viết mới

Advertisements
Fatal: cache/ is NOT writable.