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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.