刚学php不久,今天突发奇想,想把一个汉字转换成 16 进制的形式,然后再转换成汉字,于是就写了下面的代码
<?php$s = strtoupper(bin2hex('我'));// e68891echo $s;$s2 = null;for($i = 0; $i < strlen($s); $i+=2){ $s2.= 'x'.substr($s, $i, 2);}// 我echo $s2;// 我echo "$s2"; // 我echo "我";
echo hex2bin(str_replace('\x', '', '我'));
echo hex2bin(str_replace('\x', '', '我')); $s = '我';
$f = create_function('', "return "$s";");
echo $f();
eval("echo "$s";");
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号