Goal: retrieve an element of data from within a PHP object by number.
This is the print_r($data) of the object:
stdClass Object
(
[0] => stdClass Object
(
[TheKey] => 1456
[ThingName] => Malibu
[ThingID] => 7037
[MemberOf] => California
[ListID] => 7035
[UserID] => 157
[UserName] => John Doe
)
)
I can't figure out how to pull a value out of it. This is only one record of a multi-record object that should be by id rather than a name.
These are some failed attempts to illustrate what the goal is:
echo $data -> 0 -> UserName;
echo $data[0] -> UserName;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…