What does ^ mean in PHP?

前端 未结 7 870
予麋鹿
予麋鹿 2020-12-11 16:45

I came across this line of code in an application I am revising:

substr($sometext1 ^ $sometext2, 0, 512);

What does the ^ mean

7条回答
  •  情深已故
    2020-12-11 17:13

    In PHP, ^ means 'bitwise XOR'. Your code XORs together two strings, then returns at most the first 512 characters.

    In other words it does this:

    return (at most the first 512 characters of (someText1 XOR someText2))
    

提交回复
热议问题