Nolongerused3921 Posted December 25, 2006 Share Posted December 25, 2006 I realize this question has probably been asked a thousand times before in several different ways, but I'll go ahead and ask again anyways (Post-search even):1) What is the most optimal, fastest way to use bitwise? Bits (00100001), Hex (0x21), or decimal (33)... I hope I got these numbers right, I just learned/understood hex a few minutes ago.2) If I were to use hex, what would be the best length? I was thinking 0xFF, since thats 256 (?) possible numbers I could have, and I honestly don't see myself using more then that. However the idea of having 4096 numbers or even 65536 numbers sounds nice...3) Bit operators CAN be applied to all of these numbers, correct?4) As an addition to #2, what would be the difference in speed between 0x## and 0x### or even 0x####?5) Am I correct in understanding hexadecimal is the same when it comes to 0? As in, using 0's as blank space... Like 0x0021 instead of 0x216) Would I have to use said blank spaces above if I decided on a 0x#### hex system for my bitwise? Or could some numbers be 0x9 and others 0xFFFF Link to comment https://forums.phpfreaks.com/topic/31812-solved-need-help-with-hex-bitwise/ Share on other sites More sharing options...
Nolongerused3921 Posted December 25, 2006 Author Share Posted December 25, 2006 Been working with hex for awhile, a few more questions:7) Is 0x## actually only 32 possible permissions...? And 0x### 48? Its all a bit confusing at this point after getting my function to work... How many permissions [b]is[/b] each number of hex entries?8) Is the below correct? ($tmp_breakdown = "article:0xFF")[code] if(strstr($tmp_breakdown,$permission_prefix)){ $permission = explode(':',$tmp_breakdown); $permission = bin2hex($permission[1]); break; //We're done here. }[/code]I'm not sure if bin2hex can convert a string (0xFF) to hex correctly... The code [b]works[/b], but seeing as the output when printing $permission & 0x0F is 6, I'm a bit worried. Is it [b]supposed[/b] to be 6?9) Its official... I don't understand how hex bitwise works... Could someone [b]please[/b] tell me what unique permissions you can get from a two digit (0x##) hex code? Like, 0x01 for viewing, 0x02 for posting, 0x03 through 0xFF (0-F in 0x0# and 0-F in 0x#0)... Is this correct? If so, how does this work exactly? How would you combine these permissions into a single hex number?10) [b]Whoops[/b] I'd still like help but... I think I kind of got confused... I was blinded by how nice hex was and forgot that bitwise still requires ^2 numbers, correct? Like: 1,2,4,8,16,32,64,128,256,512,etc.... If this is true, how does one store them in hex? What are the equivalent numbers in hex and how many can you store in a 8 digit hex code? (32 bit... 32? :P) Link to comment https://forums.phpfreaks.com/topic/31812-solved-need-help-with-hex-bitwise/#findComment-147528 Share on other sites More sharing options...
Nolongerused3921 Posted December 26, 2006 Author Share Posted December 26, 2006 [b]ANYONE[/b] for [b]ANY[/b] question? Link to comment https://forums.phpfreaks.com/topic/31812-solved-need-help-with-hex-bitwise/#findComment-147713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.