PHP Manual
This manual is provided as a courtesy. It is not an official source. Please check php.net for updated information.
Bitwise operators allow you to turn specific bits within an integer on or off. If both the left- and right-hand parameters are strings, the bitwise operator will operate on the characters' ASCII values.
<?phpecho 12 ^ 9; // Outputs '5'echo "12" ^ "9"; // Outputs the Backspace character (ascii 8) // ('1' (ascii 49)) ^ ('9' (ascii 57)) = #8echo "hallo" ^ "hello"; // Outputs the ascii values #0 #4 #0 #0 #0 // 'a' ^ 'e' = #4?>
Table 15-3. Bitwise Operators
Don't right shift for more than 32 bits on 32 bits systems. Don't left shift in case it results to number longer than 32 bits.