array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.bin2hex.php', 1 => 'bin2hex', ), 'up' => array ( 0 => 'ref.strings.php', 1 => '字符串 函数', ), 'prev' => array ( 0 => 'function.addslashes.php', 1 => 'addslashes', ), 'next' => array ( 0 => 'function.chop.php', 1 => 'chop', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/strings/functions/bin2hex.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
bin2hex — 将二进制数据转换为十六进制表示
string
字符串。
返回指定字符串的十六进制表示。
示例 #1 bin2hex() 示例
<?php
$hex = bin2hex('Hello world!');
var_dump($hex);
var_dump(hex2bin($hex));
?>
以上示例会输出:
string(24) "48656c6c6f20776f726c6421" string(12) "Hello world!"