bin2hex()函數(shù)用于把包含數(shù)據(jù)的二進(jìn)制字符串轉(zhuǎn)換為十六進(jìn)制值
string bin2hex ( string $str )
把二進(jìn)制的參數(shù) str 轉(zhuǎn)換為的十六進(jìn)制的字符串。轉(zhuǎn)換使用字節(jié)方式,高四位字節(jié)優(yōu)先。
它返回轉(zhuǎn)義的字符串
序號(hào) | 參數(shù)和說明 |
---|---|
1 | str 二進(jìn)制字符串。 |
試試下面的實(shí)例,把"nhooo"轉(zhuǎn)換為十六進(jìn)制值:
<?php //把"nhooo"轉(zhuǎn)換為十六進(jìn)制值 $binary = "nhooo"; $hex = dechex(bindec($binary)); echo $hex; ?>測(cè)試看看 ?/?
輸出結(jié)果
0