Reputation: 355
php isn't really my thing but I would need to get the votes and percentage from votes array.
stdClass Object
(
[id] => 312
[type] => item-e
[votes] => Array
(
[plus] => Array
(
[points] => Array
(
[votes] => 1
[percentage] => 100
)
)
)
)
I tried this:
$items->votes->plus->points->votes
But I get "Object of class stdClass could not be converted to string" -error message.
No need to loop it or something?
Upvotes: 1
Views: 56
Reputation: 30001
You will have to access the array elements by key, something like this:
$items->votes['plus']['points']['votes'];
Upvotes: 1
Reputation: 9311
You need to change some object attribute access notation to array access notation:
$items->votes['plus']['points']['votes']
Upvotes: 4