I wanted to create instances in a loop, which means the number of instances totally depends on the loop. I'm not able to achieve it. I've come across many posts regarding the same and was successful for,
$this->load->library('stlstats', $param, 'instance1');
$volume1 = $this->instance1->getVolume($unit);
$this->load->library('stlstats', $param, 'instance2');
$volume2 = $this->instance2->getVolume($unit);
//Don't bother about $param and $unit, those are pre-defined.
So, in the above code, I'm able to achieve getting different volumes. But I want it to be created each iteration. If I place the code inside the loop say,
$this->load->library('stlstats', $param, 'instance1');
$volume1 = $this->instance1->getVolume($unit);
And print $volume1, then the output is the same for all the iteration. Since I have no idea about the number of iterations of the loop, how can I achieve this?
Thank you all :)