Reputation: 2765
how do I echo the [subject] value from this array?
Having troubles :P
IncomingMail Object
(
[id] => 27
[date] => 2013-12-06 12:08:29
[subject] => Re: Final test
[fromName] => Name
[fromAddress] => [email protected]
[to] => Array
(
[[email protected]] =>
)
[toString] => [email protected]
[cc] => Array
(
)
[replyTo] => Array
(
[[email protected]] => Name
)
[textPlain] => Plain text
[textHtml] => html
[attachments:protected] => Array
(
)
)
Upvotes: 0
Views: 36
Reputation: 21
jetawe, I think you meant (array) $yourObject, not array($yourObject)
echo $objectname->subject; is correct
Upvotes: 1
Reputation: 2705
$yourObject = array($yourObject);
$subject = $yourObject['subject'];
Upvotes: 0
Reputation: 219814
It's not an array. It's an object. As such you need to use the ->
operator to access the member variable (as they are called):
echo $objectname->subject;
Upvotes: 2