Jump to content

[SOLVED] Bitwise OR on a variable number of data?


Strahan

Recommended Posts

Got a problem I'm trying to figure out.  I'm looping through a security access control list.  A user may match more than one ACL entry so as it goes if a user matches the current ACL entry, it adds to a $rights array the value of the entry (an int to be used in a bitwise AND to determine if the specific right is available).

 

Now at the end I have the array $rights with a random amount of data in it.  I want to return whatever value gives the most rights.  What I want to do is something akin to return $rights[0] | $rights[1] | $rights[2];  I can easily loop on count($rights) and touch each ACL value, but since the | has to be stacked all at once I'm not sure how can I accomplish that.

 

Any idea?

Link to comment
Share on other sites

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.