I need a simple array that uses minimum memory in PHP. I want the exact C++ equivalent of an allocated block of memory where you can iterate using indices only. I found out that arrays in PHP use more memory than let's say : size*type_size (I guess for storing key values, etc). Is there anything more unsophisticated and simple ?
EDIT:
Thank you all.
Yes, I thought the idea of the string immediately after posting the question. I needed a boolean array, so that seemed to work. It's just a little slower to get/set it's characters.
Judy arrays also seem interesting but I haven't tried it yet.
I've tried SplFixedArray but it seemed that it used the same amount of memory to normal arrays (except if I've missed sth on the way).
array()? If you need more speed from php then whatarray()can give you, you're probaly using the wrong language.sizeof). And then it's still a mess. And depending on the type of items and the PHP implementation, it may lead to boxing/unboxing on all accesses, voiding much of the potential speed benefit.