sorry if this question has already been answered somewhere else, but I couldn’t find it (possibly because I had a tough time phrasing my question properly).
I’m working with a double dimension array which is the result set from a db query. Ive got the array set up so the array’s first index is the pk of the row array so the array would look like…
$array[345] = {'id' => 345,
'info1' => 'lorem',
'infor2' => 'ipsum'}
$array[448] = {'id' => 448,
'info1' => 'lorem',
'infor2' => 'ipsum'}
My question… I know the index’s are being passed as integers. So, I’m thinking (perhaps incorrectly) that they are being treated as numerical offsets by the array (as opposed to associatively.) So, if the first index is 345, does the system automatically reserve space in memory for index’s 0 through 344? The code all works perfectly, but I am wondering if this method is going to eat up a boatload of memory. Especially if I get to the point where there are only two arrays being stored at 322,343 and 554,324. Sorry if it’s a dumb question, thanks for any answers.
No, arrays are hashmaps and keys dont equal offsets, e.g
is two elements only. There is nothing reserved inbetween.