I am trying to get the current trends from the twitter api (but that’s sorta irrelevant).
I receive the information as an object. In this situation some of the properties that I need to access, are dates from when the trends were last updated, therefore I can’t hard code the property names.
Here’s an example incase I didn’t explain myself well, which I fear I didn’t 🙁
stdClass Object
(
[2011-03-09 02:45] => Array
(
[0] => stdClass Object
(
[promoted_content] =>
[events] =>
[query] => RIP Mike Starr
[name] => RIP Mike Starr
)
[1] => stdClass Object
(
[promoted_content] =>
[events] =>
[query] => Mac & Cheese
[name] => Mac & Cheese
)
Note: This is not the full object
You can traverse an object’s properties using
get_object_vars()