更新..移至新问题.
好吧,阅读 PHP 文档后,现在这些按位运算符就很清楚了,但是,嗯,这是什么?
#dump1
var_dump('two identical strings' | 'two identical strings'); // mind the |
// string(21) "two identical strings"
#dump2
var_dump('two identical strings' ^ 'two identical strings'); // mind the ^
// string(21) ""
Why #dump2
显示长度== 21,但是0个字符?
When copied in Notepad++ there are no signs of characters inside the string, so, how come strlen > 0
? - this confuses me, because Notepad++ can show some kind of bit-level (at least I think that those are bit-level, correct me if I'm wrong) characters, see picture:
![enter image description here](https://i.stack.imgur.com/AZbJl.gif)
这实际上是由于:
$string = 'i want you to compare me with an even longer string, that contains even more data and some HTML characters, like € ' ^ 'And I am going to add some HTML characters, like € again to this side and see what happens'; // mind the ^
var_dump(htmlentities($string)); // had to add htmlentities, otherwise > (<) characters are added in this case, therefore messing up the output - Chrome force closes `<body>` then
// string(101) "(NA'TAOOGCP MI<<m-NC C IRLIHYRSAGTNHEI RNAEAAOP81#?"
我很高兴看到这个#dump2 相关问题得到解答,提前致谢!