I'm experimenting with SplFixedArray. I have some work done with dynamic arrays which i'm trying to convert to more memory efficient fixed arrays (limited RAM to work with).
Reading some PHP documentation, found the function in the Title and proceeded to just apply to an array which is like:
$array[x][y]['field']
(3d array with string as index, impossible in fixed arrays) by doing
$testArray = SplFixedArray::fromArray(generateArray(256));
// generateArray is a function to create the array and set it to zero.
I checked if i could get some memory savings from this versus standard array and no. Replaced the string index with numbers, same amount of ram used (94 mb) to generate the array.
If i use SplFixedArray properly (not converting from an existing array) i low the mem used to 74mb, but i have a lot of functions and rutines which works with the base 3d array and would be a pain in the ass to convert everything to "proper" fixed array. That's why when i read abut SPL::fromArray i jumped on my chair. But with these tests, i found ZERO memory nor speed benefits.
Am i not using it correctly? Is this function just for other type of things?
Thanks!