I'm struggling with extracting values from an array. print_r($offers); output is as follow:
Array
(
[0] => Object
(
[id] => 41302512
[amount] => 244
[price] => 10.17
[sellerId] => 1678289
[sellerName] => stan_J23
)
[1] => Object
(
[id] => 41297403
[amount] => 51
[price] => 10.18
[sellerId] => 2510426
[sellerName] => kszonek1380
)
[2] => Object
(
[id] => 41297337
[amount] => 581
[price] => 10.18
[sellerId] => 2863620
[sellerName] => NYski
)
)
However, echo $offers[0]['id']; doesn't work. I need to extract the values for each array node to variables i.e. $id=value_of_key_id and so on. The array has 10 nodes from 0 to 9.
[0]is an object, not an array. So do$offers[0]->id$offers[0]is an Object, not an array. Use$offers[0]->id