Hi. Is there a way to doing XOR in php that works for both words and numbers?
"Blah" XOR "20" => "coderesult" or: 10 XOR "20" => "coderesult"
Thanks.
probably will have to convert the string using ord() on each character.
Otherwise, I suspect that PHP will use 0 for the string value when doing the XOR.
Thanks. But I writed a function for doing the Xor,Is there a php function for do that?
Hmm... I think that my first response could be a little wrong.
From the PHP manual
If both the left- and right-hand parameters are strings, the bitwise operator will operate on the characters in this string.
Anyway, the XOR operator in PHP is ^