Sunday, July 12, 2009

I have an object in PHP, how do I loop through every member? Like a foreach for objects?

I have this object (which I printed using print_r), and I need to know how to loop through every member to do something with the data.





stdClass Object


(


[OrganizationId] =%26gt; 00D300000006Iw4EAE


[ActionId] =%26gt; 04k500000004CZpAAM


[SessionId] =%26gt;


[EnterpriseUrl] =%26gt; https://na3-api.salesforce.com/services/...


[PartnerUrl] =%26gt; https://na3-api.salesforce.com/services/...


[Notification] =%26gt; stdClass Object


(


[Id] =%26gt; 04l50000000LlctAAC


[sObject] =%26gt; stdClass Object


(


[Id] =%26gt; 0035000000SN1ZMAA1


[AccountId] =%26gt; 0015000000Hq2pWAAR


[CreatedById] =%26gt; 00550000000lnTzAAI


[CreatedDate] =%26gt; 2007-08-02T21:20:38.000Z


)


)


)





Same thing is doing a foreach with an array.

I have an object in PHP, how do I loop through every member? Like a foreach for objects?
use array_keys to list the keys then you can cycle through the keys using them to index the array...

covent garden

No comments:

Post a Comment