Jump to content

Recommended Posts

Hey All,

Ive been coding PHP for a few years now but have never looked into Bitwise operators before..

I have picked up a few things but there is one part in particularly that sis bugging me..

 

I was reading a script and noticed this:

$Session =& new Session();

 

the Session class construct returns the session_id()

I was wondering if anybody could shed some light on how a bitwise operator such as this works in this context?

 

Link to comment
https://forums.phpfreaks.com/topic/184590-bitwise-operators-on-a-class-instance/
Share on other sites

this is how a bitwise operator works

consider a value , 3, in binary code, it is 00000011

and another value, 4, in vunary code, it is 00000100

 

if 3 &  4, then returns 0

00000011

00000100

you do the and  by each bit

for example, the right most bit, 1 (from 3), and 0 ( from 4), it is 0

2nd right most bit, 1 from 3, 0 from 4 is 0

3rd right most bit, 0 from 3, 1 from 4, is 0

and the rest is 0 too

Thanks for that link..

I was getting myself confused with =& and &=

I should learn to read better.

 

That link was exactly what I was looking for it had absolutley nothing to to with bitwise at all ::)

 

Thanks for clearing it all up..

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.