I\'m working with a large array which is a height map, 1024x1024 and of course, i\'m stuck with the memory limit. In my test machine i can increase the mem limit to 1gb if i
In addition to the accepted answer and suggestions in the comments, I'd like to suggest PHP Judy array implementation.
Quick tests showed interesting results. An array with 1 million entries using regular PHP array data structure takes ~200 MB. SplFixedArray uses around 90 megabytes. Judy uses 8 megs. Tradeoff is in performance, Judy takes about double the time of regular php array implementation.