php hex2bin() function


  Translation results:

英[bɪn] 美[bɪn]

n. Box, container; binary; trash can; (basement) wine storage

vt. Put... into the storage; put …Put it in the box

Third person singular: bins Plural: bins Present participle: binning Past tense: binned Past participle: binned

php hex2bin() functionsyntax

Function:Convert hexadecimal string to binary string

Syntax: hex2bin (string)

Parameters :

ParameterDescription
stringRequired, specify required Converted string

Description: Returns the binary representation of the given data or returns FALSE on failure.

php hex2bin() functionexample

<?php
$data = "68656c6c6f207068702e636e";
$res = hex2bin($data);
echo $res;
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

hello php.cn
<?php
$str1 = "4c6561726e696e6720504850";
echo hex2bin($str1);
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Learning PHP

Home

Videos

Q&A