why is php combining array when I do foreach. see below
If I enter the following code, I will get id1 id2 individually.
foreach($array as $value){
$id = $value->id;
echo $id;
}
now if I try to use the ids to do a query
foreach($array as $value){
$id = $value->id;
$result = $this->model->run_some_query($id);
var_dump($result);
}
for the above code. Since I am foreach looping not passing in an array of ids, I expect to get 2 sets of seperate array. array1 with result from id1, array2 with result from id2. but instead I get 1 array with result from both id merged together.
How to make it so the array is seperated.