First part of my question: "unrolled_data" is not a column heading in a table. It is simply the name that's being given to a subset I'm about to create, correct?
Second part of my question: Beginning at line 26, I've got this:
$index=count($statement['unrolled_data']) // how can you count an array that has yet to be processed?
foreach($statement['unrolled_data'] as $I->$enc){ //where did $enc come from and what's happening here?
For the sake of clarity and brevity, I've attempted to streamline the function that I'm working on. What you see above is a portion of the actual code. I've got that below, just in case there's something missing from the puzzle that you need.
Bottom line: I'm trying to understand how "unrolled_data" is being defined and calculated.
This code is nearly incomprehensible, cannot be tested, and should be refactored. Nobody writes this kind of spaghetti any more, at least not since the last century. One of the problems I see here is that the behavior of the code is tightly coupled to the content of the data. But because of the way this code is written you cannot provide mock-data. So a logical step in trying to discern behavior would be to look at the data. You can do that with var_dump(). http://php.net/manual/en/function.var-dump.php
remember that you are inside a loop, so it is being filled by prdvious iterations. on the first one, it will be 0 indeed.