Bitwise Operators

Bitwise Operators

Bitwise Operators

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 in this string.
Bitwise operators in PHP is similar to the bitwise operator in C &

C++.

Example:

echo 12 ^ 9; // Outputs ‘5′

echo “12″ ^ “9″; // Outputs the Backspace character (ascii 8)
// (’1′ (ascii 49)) ^ (’9′ (ascii 57)) = #8

echo “hallo” ^ “hello”; // Outputs the ascii values #0 #4 #0 #0 #0
// ‘a’ ^ ‘e’ = #4

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.