I'm using the Twitter API (version 1.1) and am trying to get a specific variable from the JSON return via PHP. $mentions is the returned json_decode() value of a GET statuses/mentions_timeline
request.
I have the following PHP:
foreach($mentions as $mention) {
echo '<pre>' . print_r($mention) . "</pre><br>";
}
This works as expected, however when I add ['created_at'] to $mention I get:
Fatal error: Cannot use object of type stdClass as array
Expected return as per the twitter docs:
[ // mentions
{ // mention
"created_at": "Mon Sep 03 13:24:14 +0000 2012"
}
]
This is an example of what's returned with print_r($mention) (inside the loop):
stdClass Object (
[created_at] => Sat Apr 06 14:56:36 +0000 2013
)
Just what is this stdClass and how do I interact with it, if possible?