Reputation: 121
I have the following objects with arrays and trying to get the value of email. How can this be done?
stdClass Object (
[status] => stdClass Object (
[info] => Unsubscribe List [code] => 200
)
[data] => Array (
[[email protected]] => stdClass Object (
[date] => 2013-01-28 08:09:19
[origin] =>
)
[[email protected]] => stdClass Object (
[date] => 2013-01-28 08:35:59
[origin] =>
)
)
)
Currently i can access the date values with the following foreach.
foreach ($fnret->data as $msg)
{
echo $msg->date; // shows 2013-01-28 08:35:59
}
Upvotes: 3
Views: 11554
Reputation: 1497
This one should work :
foreach ($fnret->data as $email => $msg) {
// echo $msg->date; // shows 2013-01-28 08:35:59
echo $email;
}
Upvotes: 8