ord,md5在@上显示不同的行为 [英] ord, md5 shows different behaviour on @

查看:76
本文介绍了ord,md5在@上显示不同的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 ord 来检查 @ @ 是相同的字符.但是 ord 输出相同的值,而 md5 不输出.

I used ord to check @ and @‪ are same char. But ord output the same value while md5 does not.

php -a
Interactive shell

php > echo ord('@');
64
php > echo ord('@‪');
64

php > echo md5('@');
518ed29525738cebdac49c49e60ea9d3
php > echo md5('@‪');
e6124653b6620abe51d7c401a7644674
php >

这是屏幕截图,

Here is the screenshot,

推荐答案

您的第二个是 @ ,后跟 U + 202A-从左向右嵌入.由于它们是不同的字符串,因此自然它们具有不同的MD5编码.

Your second one is @ followed by U+202A - LEFT-TO-RIGHT EMBEDDING. As they are different strings, naturally they have different MD5 encodings.

php > echo md5("@\u{202a}");
e6124653b6620abe51d7c401a7644674

这篇关于ord,md5在@上显示不同的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆