Friday, 28 July 2017

What does ^ mean in PHP?



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




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


What does the ^ mean?


Answer



It's a bitwise operator.



Example:




"hallo" ^ "hello"


It outputs the ASCII values #0 #4 #0 #0 #0 ('a' ^ 'e' = #4).


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...