Page 1 of 1

array_push and foreach with objects

Posted: Mon Aug 08, 2011 9:56 am
by momo_8888
The exact example is to add channels to an array of channels .
The channels sent by JSON and when I got it the following code happens
$TEMPCHANNEL=new Channel();

//input Channels ----------------------------- CNN,BBC,CNBC --------------------------
foreach(FOREACH SYNT)
{
$TEMPCHANNEL->set_logo();
$TEMPCHANNEL->set_type();
$TEMPCHANNEL->set_title();
array_push($CHANNELS,$TEMPCHANNEL);
}

// The Result of CHANNELS array ------------------------- CNBC,CNBC,CNBC ---------------------
I got all the elements with the value of last item entered .

Re: array_push and foreach with objects

Posted: Mon Aug 08, 2011 1:14 pm
by AbraCadaver
That's not even parse-able code dude.