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
Post a Comment