如何在完成php循环后将更多数据推入数组?

im trying to do something here with php, i want after the loop finishes looping with the data array to add more data into the array and again start looping.

i.e.

    foreach($arrayData->data as $item) {

         echo $item->id;


    }

   //add more data to $arrayData 
   //and do the foreach loop again

i dont now if this is impossible but i thought let me give it a try and ask, thank. ps. this is not the all the code on the page, but i tried to make it simple fro your eyes :))

I guess you can do either of the following

use

array_push($arrayData->data, "val1", "val2");

or use simple array assignment like

$arrayData->data["another key"]  = "another value";

I am assuming that $arrayData->data is your array

By the look of thing your $item is an object too. So replace the string values with your objects