vineld Posted July 8, 2009 Share Posted July 8, 2009 I have encountered an object that contains an unnamed array that looks like this: stdClass Object ( [string] => Array ( [0] => 1 [1] => 4 [2] => 14 ) ) How do I access that array? Link to comment https://forums.phpfreaks.com/topic/165200-solved-accessing-object-array-without-name/ Share on other sites More sharing options...
WolfRage Posted July 8, 2009 Share Posted July 8, 2009 you var dumped it correct? What did you var dump? Replace $soemthing in my code. <?php $something[]// if you want a specific key just specify. Else to go through it all use a foreach. ?> Link to comment https://forums.phpfreaks.com/topic/165200-solved-accessing-object-array-without-name/#findComment-871122 Share on other sites More sharing options...
rhodesa Posted July 8, 2009 Share Posted July 8, 2009 foreach($obj->string as $num) echo $num; Link to comment https://forums.phpfreaks.com/topic/165200-solved-accessing-object-array-without-name/#findComment-871127 Share on other sites More sharing options...
vineld Posted July 8, 2009 Author Share Posted July 8, 2009 Thanks, just figured that out myself, it is actually called string =) Link to comment https://forums.phpfreaks.com/topic/165200-solved-accessing-object-array-without-name/#findComment-871157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.