PHP bin2hex()函数

bin2hex()函数是一个字符串函数,用于将给定的ASCII字符串转换为十六进制值。

它接受字符串并返回十六进制转换后的字符串。

语法:bin2hex(string);

例子:Input:

str = Hello world

Output:

hex_str = 48656c6c6f20776f726c64

Input:

str = ABC 123 @#$%. XYZ

Output:

hex_str = 4142432031323320402324252e2058595a

PHP代码:<?php

$str = "Hello world";

$hex_str = bin2hex($str);

//打印两个字符串

echo ("str = " . $str . "\n");

echo ("hex_str = " . $hex_str . "\n");

$str = "ABC 123 @#$%. XYZ";

$hex_str = bin2hex($str);

//打印两个字符串

echo ("str = " . $str . "\n");

echo ("hex_str = " . $hex_str . "\n");

?>

输出结果str = Hello world

hex_str = 48656c6c6f20776f726c64

str = ABC 123 @#$%. XYZ

hex_str = 4142432031323320402324252e2058595a

php bin2hex park,PHP bin2hex()函数与示例相关推荐

  1. PHP openssl_sign()函数代码示例

    本文整理汇总了PHP中openssl_sign函数的典型用法代码示例.如果您正苦于以下问题:PHP openssl_sign函数的具体用法?PHP openssl_sign怎么用?PHP openss ...

  2. php指定长度 分割整形,php指定长度分割字符串str_split函数用法示例

    本文实例讲述了php指定长度分割字符串str_split函数用法.分享给大家供大家参考,具体如下: 示例1:$str = 'abcdefgh'; $arr = str_split($str,2); 运 ...

  3. getdate函数_PHP getdate()函数与示例

    getdate函数 PHP getdate()函数 (PHP getdate() function) getdate() function is used to get the local date/ ...

  4. 安卓log.e函数打印示例_log1p()函数以及C ++中的示例

    安卓log.e函数打印示例 C ++ log1p()函数 (C++ log1p() function) log1p() function is a library function of cmath ...

  5. gettimeofday_PHP gettimeofday()函数与示例

    gettimeofday PHP gettimeofday()函数 (PHP gettimeofday() function) gettimeofday() function is used to g ...

  6. dir函数_PHP dir()函数与示例

    dir函数 PHP dir()函数 (PHP dir() function) dir() function is an instance of the directory class, it is u ...

  7. PHP rewinddir()函数与示例

    PHP rewinddir()函数 (PHP rewinddir() function) rewinddir() function is used to rewind/reset the direct ...

  8. stl swap函数_C ++ STL | vector :: swap()函数与示例

    stl swap函数 C ++ STL vector :: swap()函数 (C++ STL vector::swap() function) vector::swap() function is ...

  9. C#回调函数应用示例,形象比喻方法助理解

    C#回调函数应用示例,形象比喻方法助理解,整理了一个简单的例子来说明回调函数的用法: namespace CallBackFunction {     class Program     {      ...

  10. php解escape,PHP下escape解码函数用法示例

    这篇文章主要为大家详细介绍了PHP下escape解码函数用法示例,具有一定的参考价值,可以用来参考一下. 感兴趣的小伙伴,下面一起跟随512笔记的小编小韵来看看吧!GB2312编码: 代码如下: fu ...

最新文章

  1. 关于C#开发山寨操作系统,程序语言,浏览器,IDE,Office,Photoshop等大型程序的可行性歪论及意义...
  2. Linux文件管理命令vi,linux人云亦云(16)文件管理之VI命令一
  3. linux shell mv 文件 文件夹移动重命名 命令
  4. 【转】 GetProcAddress()用法
  5. 机器学习怎么入门?一份速成指南拿好!
  6. IA-32 Intel手册学习笔记(一)系统架构概述
  7. “3D几何与视觉技术”全球在线研讨会第三期
  8. Django Python Web应用程序框架简介
  9. Git工作流中常见的三种分支策略:GitFlow、GitHubFlow和GitLabFlow
  10. 华为、大众组建合资公司?相关回应来了
  11. PGA自动管理原理深入分析及性能调整
  12. 卸载iis express后80端口仍然被占用的解决方法
  13. Undefined control sequence.l.463 \cita
  14. poj Gone Fishing 枚举加贪心 当初做的很纠结啊!!终于A了,与大家分享一下经验
  15. C#技术点--修改系统时间
  16. 如何防止用户重复提交数据
  17. OpenDDS架构说明
  18. python人工智能教程百度云_【python实战教程百度网盘】求最新python人工智能视频教程网盘链接...
  19. 鸟哥linux命令小结
  20. Python pandas.DataFrame.median函数方法的使用

热门文章

  1. m115b linux 驱动下载,m115b驱动下载
  2. 新闻发布系统(java实现)+论文
  3. netbean 快捷键
  4. 百度 Echarts 地图-模拟迁徙,实现自动切换地图
  5. c语言中%d %%d %%%d和\\%d的区别
  6. java弹出子窗口_java实现点击按钮事件弹出子窗口
  7. 配置tracker服务
  8. 卷积神经网络概念与原理
  9. adobe mac怎么卸载 ?彻底卸载Adobe Mac软件的正确做法
  10. 项目源码--Android聚合视频类播放器