Fastest way to represent a collection of bits in PHP?

Posted by Piskvor on Stack Overflow See other posts from Stack Overflow or by Piskvor
Published on 2010-03-09T09:27:55Z Indexed on 2010/03/09 9:36 UTC
Read the original article Hit count: 276

Filed under:
|
|

What is a good way to represent a collection of bits?

I have a set of various on/off toggles (thousands of them) and need to store and retrieve their state. The naïve implementation would be an array of booleans, but I'm wondering if there's a better way (better in terms of access speed and/or memory requirements).

I've found this BitArray implementation, but it's limited to 32 bits, which is not enough for this case.

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays