I have an object (stored as $videos) that looks like this
object(stdClass)#19 (3) {
[0]=>
object(stdClass)#20 (22) {
[\"id\"]=>
string(1) \
$videos->{0}->id worked for me.
Since $videos and {0} both are objects, so we have to access id with $videos->{0}->id. The curly braces are required around 0, as omitting the braces will produce a syntax error : unexpected '0', expecting identifier or variable or '{' or '$'.
I'm using PHP 5.4.3.
In my case, neither $videos{0}->id and $videos{0}['id'] worked and shows error :
Cannot use object of type stdClass as array.