I have an object (stored as $videos) that looks like this
object(stdClass)#19 (3) {
[0]=>
object(stdClass)#20 (22) {
[\"id\"]=>
string(1) \
Update 2019
Moving on to the best practices of OOPS, @MrTrick's answer must be marked as correct, although my answer provides a hacked solution its not the best method.
Simply iterate its using {}
Example:
$videos{0}->id
This way your object is not destroyed and you can easily iterate through object.
For PHP 5.6 and below use this
$videos{0}['id']