Tuesday, 15 April 2014

php - Problems accessing two different types of array -



php - Problems accessing two different types of array -

as relative newbie php i'm having problem accessing various elements in array. have access 2 different types of array. first illustration works fine although sec throws error.

any pointers appreciated.

ps. come javascript, vbscript background understand concept of array. cheers!

the next code sample works

// below dump of $dataarray array (size=4) 0 => object(simplexmlelement)[13] public '@attributes' => array (size=15) 'campaignid' => string '215999956' (length=9) // below writes out $dataarray foreach($dataarray $val) { print $val['campaignid']; }

the next code sample doesn't work

// below dump of $dataarray array (size=4) 0 => object(adgroup)[73] public 'campaignid' => string '112520126' (length=9) // below writes out $dataarray foreach($dataarray $val) { print $val['campaignid']; }

the first array , sec object. access campaignid in sec version want to

print $val->campaignid

php arrays

No comments:

Post a Comment