Buddski Posted December 10, 2009 Share Posted December 10, 2009 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 More sharing options...
greatstar00 Posted December 10, 2009 Share Posted December 10, 2009 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 Link to comment https://forums.phpfreaks.com/topic/184590-bitwise-operators-on-a-class-instance/#findComment-974486 Share on other sites More sharing options...
Buddski Posted December 10, 2009 Author Share Posted December 10, 2009 I understand bitwise operators, I just dont get the $Session &= new Session(); aka $Session = $Session & new Session(); It just confuses the hell outta me... Any insight would be appreciated.. Link to comment https://forums.phpfreaks.com/topic/184590-bitwise-operators-on-a-class-instance/#findComment-974507 Share on other sites More sharing options...
.josh Posted December 10, 2009 Share Posted December 10, 2009 Assignment by reference edited to fix link Link to comment https://forums.phpfreaks.com/topic/184590-bitwise-operators-on-a-class-instance/#findComment-974516 Share on other sites More sharing options...
Buddski Posted December 10, 2009 Author Share Posted December 10, 2009 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.. Link to comment https://forums.phpfreaks.com/topic/184590-bitwise-operators-on-a-class-instance/#findComment-974558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.