Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP operator

Posted on 2006-10-25
6
Medium Priority
?
210 Views
Last Modified: 2006-12-28
I'm reading an ebook, it mention about those operators:
^=, &=, |=, <<=, >>=

Can anyone tell me what they are?
Thank in advanced
0
Comment
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
  • Learn & ask questions
  • 2
6 Comments
 
LVL 49

Expert Comment

by:Roonaan
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

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

Accepted Solution

by:
Roonaan earned 400 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

See also: http://nl3.php.net/manual/en/language.operators.bitwise.php

-r-
0
 
LVL 2

Expert Comment

by:_delas
ID: 17942008
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question