php bin2hex() 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 bin2hex() functionsyntax

Function:Convert a binary string containing data to a hexadecimal value

Syntax: bin2hex (string)

Parameters:

ParametersDescription
stringRequired , specify the string to be converted

Description: Convert the binary parameter string to a hexadecimal string. Conversion uses byte mode, with the high nibble taking precedence.

php bin2hex() functionexample

<?php
$data = "hello php.cn";
$res = bin2hex($data);
echo $res;
?>

Run instance»

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

Output:

68656c6c6f207068702e636e
<?php
$str1 = "Learning PHP";
echo bin2hex($str1);
?>

Run Instance»

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

Output:

4c6561726e696e6720504850

Home

Videos

Q&A