What does ^ mean in PHP?

前端 未结 7 829
予麋鹿
予麋鹿 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:32

    ^ is the bitwise exclusive OR operator. For each bit in a value, it looks to see if that bit is the same in the other value; if it is the same, a 0 is output in its place, otherwise a 1 is output. For example:

      00001111
    ^ 01010101
      --------
      01011010
    
    0 讨论(0)
提交回复
热议问题