This didn't work. Apparently from[] returns an array of objects, however I have no idea how to access the object within the array.

print_r gives this:

Array ( [0] => stdClass Object ( [personal] => Beth Gore [mailbox] => bethanoia [host] => habitformer.co.uk ) )

I've tried this:

echo $header->from->mailbox."@".$header->from->host;

which doesn't report an error at all, even with full error reporting..

... breaking news.. just cracked it.

echo $header->from[0]->mailbox."@".$header->from[0]->host;

Bascially the array of objects is the whole [0] => stdClass thing.. AGGH!!

Always doing this.

Thanks anyway :)

Beth Gore
--
http://www.habitformer.co.uk


Andrew Brampton wrote:

Big guess but I think maybe:

$header[0]->from['mailbox'];

Also I suggest you turn your PHP Error Level up to E_ALL in your php.ini
file (or temporarly at the top of your scripts with error_reporting
(E_ALL);, this will help debug programs like this :))

Andrew
----- Original Message -----
From: "Beth Gore" <[EMAIL PROTECTED]>
To: "PHP General List" <[EMAIL PROTECTED]>
Sent: Tuesday, December 24, 2002 6:42 PM
Subject: [PHP] objects within arrays



Hi,

I'm really struggling with this - I'm writing a simple webmail client
for myself (because they've blocked the common ones at work hehe)

Anyway, as soon as I tried to access..

$header = imap_header($inbox,$msgID);

$header->from['mailbox'];

... I get nothing.

I did a print_r on that, and I got..

Array ([0] = StdClass Object([personal] = "blah" ); etc...

so how do I access the data within the Object bit? a simple
$header->from['personal'] refuses to output anything.

Sorry to be a pain again, I know this is simple language stuff but I
can't find it in the manual. :)

Beth Gore
--
http://www.habitformer.co.uk



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to