Solved

# PHP operator

Posted on 2006-10-25
206 Views
^=, &=, |=, <<=, >>=

Can anyone tell me what they are?
0
Question by:tunglam
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 49

Expert Comment

ID: 17804151
Those are bitwise operators

\$a &= \$b is the same as \$a = \$a & \$b (bitwise and)
\$a |= \$b is the same as \$a = \$a | \$b (bitwise or)

\$a <<= 2 is the same as \$a = \$a << 2 (leftshifting bits)

(leftshifting 2 bits is the same as multiplying by 4, 3 bits is times 8, 4 bits, times 16, etc).

-r-
0

Author Comment

ID: 17811973
Can you what is bitwise operators?
What are they for? And give me some example? Thank you!
0

LVL 49

Accepted Solution

Roonaan earned 100 total points
ID: 17812021
Bitwise operators work on binairy forms of data (the zero's and one's.)

So 2 & 3 equals in binairy code 0010 && 0011 => 0010 (only the second one from the right is in both binairy

0101 << 1 is the same as putting all zero's and one's one position to the left: 1010
0101 << 3: 1000
0101 >> 1: (shift to right) 0010
0101 >> 3: 0001

-r-
0

LVL 2

Expert Comment

ID: 17942008
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Help with mod_substitute 18 77
PHP processing webform 25 45
How can I send attachment with mail 5 25
PHP, Curl and XML 13 15
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
###### Suggested Courses
Course of the Month4 days, 7 hours left to enroll