Re: optimizing space for array of booleans
| From: | Virgilio Quilario | Date: | Mon, 23 Feb 2009 15:21:10 +0000 |
| Subject: | Re: optimizing space for array of booleans | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288676@lists.php.net to get a copy of this message | ||
> Some languages allows to bit-pack structures to save spaces. Since PHP
> doesn't have native set data type and operations, will array of booleans be
> optimized as such? If not, how can I achieve the same result? I need to save
> about 200 boolean values and I guess it's a good idea to use bitsets.
>
> Requirements:
> - Easy to use (set, unset, test), so C way to use bitwise operations is
> simply rejected.
> I need something like Pascal's set.
> - Small space (bit level if possible)
>
> --
> View this message in context: 9èpÌ^uk7
> ¡ßƒhttp://www.nabble.com/optimizing-space-for-array-of-booleans-tp22159131p22159131.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
hi,
you should not worry about optimizing boolean values unless you would
store them in database.
anyways, use bitwise operators http://ph.php.net/language.operators.bitwise
virgil
http://www.jampmark.com