教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 实现PHP中的hex2bin

实现PHP中的hex2bin

发布时间:2016-10-29   编辑:jiaochengji.com
教程集为您提供实现PHP中的hex2bin等资源,欢迎您收藏本站,我们将为您提供最新的实现PHP中的hex2bin资源
php中有 bin2hex方法,但没有 hex2bin方法,以下简单实现 hex2bin :



<span style="color: rgb(0, 0, 0);"><?</span><span style="color: rgb(0, 0, 0);">php
</span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> hex2bin(</span><span style="color: rgb(128, 0, 128);">$data</span><span style="color: rgb(0, 0, 0);">) {
     </span><span style="color: rgb(128, 0, 128);">$len</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 128);">strlen</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$data</span><span style="color: rgb(0, 0, 0);">);
     </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 128);">pack</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">H</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$len</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$data</span><span style="color: rgb(0, 0, 0);">); } 
</span><span style="color: rgb(0, 0, 0);">?></span><span style="color: rgb(0, 0, 0);"> </span> 

您可能感兴趣的文章:
实现PHP中的hex2bin
php中加密解密DES的正确使用姿势
php 十六进制转化为二进制的代码
用PHP实现SHA1withRSA签名、加密、验证
php字符串函数有哪些
PHP字符串函数与使用分析
php 字符串函数教程与实例代码
php字符串处理函数分类(优秀推荐)
php文件上传代码大全(实例分享)
php下载css中图片函数

[关闭]
~ ~