-2
I’m making a comparison of two binary numbers by checking which index from right to left bits are different. I found a code as soon as it works:
strspn(strrev("1111") ^ strrev("1101"), "\0");
This code returns to me 1
which is the index of the first bit of the numbers which are different. However I did not understand "bulhufas" of the code nor what that means: (^). I tried searching in the manual itself and did not find. To try to figure out what this is, I did this:
var_dump("aaab" ^ "aaac");
Only it returns a "string" of control character SOH
.
So my question boils down to three parts:
- What is this sign ( ) and what it does exactly?
- How that first line of code works?
- Because this return in control character
SOH
?
Thank you manowww!
– Andrei Coelho