stdClass object usage? Output of a print_r()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

stdClass object usage? Output of a print_r()

Post by Chris Corbyn »

How do I pull out JUST the subject from this? I tried $headers['subject'] but that doesn't return anything.

Thanks :-)
stdClass Object
(
[date] => Mon, 1 Nov 2004 09:08:19 -0800
[Date] => Mon, 1 Nov 2004 09:08:19 -0800
[subject] => Question about payment for item #5134383813 - Phillips (<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>) 48/16 DVD-ROM Drive (No Reserve)
[Subject] => Question about payment for item #5134383813 - Phillips (<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>) 48/16 DVD-ROM Drive (No Reserve)
[message_id] => <998070348.1099328899219.JavaMail.ebayapp@sj-v3conta08>
[toaddress] => c.a.corbyn@ntlworld.com
[to] => Array
(
[0] => stdClass Object
(
[mailbox] => c.a.corbyn
[host] => ntlworld.com
)

)

[fromaddress] => keithemberton@hotmail.com
[from] => Array
(
[0] => stdClass Object
(
[mailbox] => keithemberton
[host] => hotmail.com
)

)

[reply_toaddress] => keithemberton@hotmail.com
[reply_to] => Array
(
[0] => stdClass Object
(
[mailbox] => keithemberton
[host] => hotmail.com
)

)

[senderaddress] => keithemberton@hotmail.com
[sender] => Array
(
[0] => stdClass Object
(
[mailbox] => keithemberton
[host] => hotmail.com
)

)

[Recent] =>
[Unseen] =>
[Flagged] =>
[Answered] =>
[Deleted] =>
[Draft] =>
[Msgno] => 27
[MailDate] => 1-Nov-2004 17:08:15 +0000
[Size] => 14661
[udate] => 1099328895
)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Sorry I should have done this before I posted. Checked in the manual for "Object" and saw that the syntax is not obj[el] it is infact obj->el

so

Code: Select all

$headers->subject
worked.
Post Reply