php - Get the property of an item in array -


im trying values of array, dont know why cant, can me? how array start:

 $userstable = {"userstats": [{                    "type": "user",                    "name": "john stripes",                    "roll": "moderator",                    "entries": [..... 

im doing var_dump($userstable) , can acces first level, im stuck, returns "trying property of non-object".

at first level, returns:

array(1) { [0]=> object(stdclass)#90 (5) { ["type"]=> string(4) "user" ["name"]=> string(12) "john stripes" ["roll"]=> string(9) "moderator" ["entries"]=> array(191) { [0]=> object(stdclass)#91 (9) { ... 

im trying in , return $userstable->userstats->name

thanks help!

userstats array, not object. if want access objects in array, must use index in array, e.g. this:

$userstable->userstats[0]->name // name property of first object in userstats 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -