PHP bin2hex() 函数

PHP 教程 · 2019-01-29 10:11:28

实例

把 "Hello World!" 转换为十六进制值:

<?php
$str = bin2hex("Hello World!");
echo($str);
?>

定义和用法

bin2hex() 函数把 ASCII 字符的字符串转换为十六进制值。字符串可通过使用 pack() 函数再转换回去。

语法


bin2hex(string)


参数 描述
string 必需。规定要转换的字符串。

技术细节

返回值: 返回要转换字符串的十六进制值。
PHP 版本: 4+

更多实例

实例 1

把一个字符串值从二进制转换为十六进制,再转换回去:

<?php
$str = "Hello world!";
echo bin2hex($str) . "<br>";
echo pack("H*",bin2hex($str)) . "<br>";
?>

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

A Guide to Monte Carlo Simulations in Statistical Physics

A Guide to Monte Carlo Simulations in Statistical Physics

Landau, David P./ Binder, Kurt / Cambridge Univ Pr / 2005-9 / 786.00元

This new and updated edition deals with all aspects of Monte Carlo simulation of complex physical systems encountered in condensed-matter physics, statistical mechanics, and related fields. After brie......一起来看看 《A Guide to Monte Carlo Simulations in Statistical Physics》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具