Trying to get property of non object errors
<p>I'm trying to figure out why I keep getting a few trying to get property of non object errors. with the array that I have created. I created the array and am foreaching it out and by the looks of my object array those properties do exist.</p>

<p>I am getting the errors in this area:</p>

<pre><code>// Separates each of the last 5 pesonal messages
foreach ($last_5_personal_messages AS $message)
{
    echo '&lt;li&gt;';
    echo '&lt;span class="icon avatar"&gt;&lt;img src="'.$message-&gt;sender_avatar.'" alt="" /&gt;&lt;/span&gt;';
    echo '&lt;span class="name"&gt;&lt;a href="'.$site_url.'/personalmessages/viewmessage/'.$message-&gt;message_id.'"&gt;&lt;strong&gt;'.$message-&gt;sender_name.'&lt;/strong&gt;&lt;/a&gt;&lt;span class="time"&gt;'.$message-&gt;datetime_sent.' ago&lt;/span&gt;&lt;/span&gt;';
    echo '&lt;span class="msg"&gt;'.$message-&gt;subject.'&lt;/span&gt;';
    echo '&lt;/li&gt;';
}
?&gt;


Array
(
[0] =&gt; stdClass Object
    (
        [message_id] =&gt; 1
        [subject] =&gt; Test Message
        [datetime_sent] =&gt; 2 weeks
        [attachments] =&gt; 
        [priority] =&gt; 0
        [message_content] =&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        [message_read] =&gt; 0
        [is_favorite] =&gt; 0
        [sender_name] =&gt; Mike Scott
        [sender_email_address] =&gt; myemail@myemail.com
        [sender_avatar] =&gt; http://dev.myserver.com/assets/themes/supr/images/avatars/avatar5.jpg
    )

[1] =&gt; stdClass Object
    (
        [message_id] =&gt; 2
        [subject] =&gt; Testing PM Message
        [datetime_sent] =&gt; 3 weeks
        [attachments] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [file_name] =&gt; file1.jpg
                        [is_file] =&gt; 1
                        [file_size] =&gt; 7.01 KB
                        [file_location] =&gt; assets/downloads/file1.jpg
                    )

                [1] =&gt; Array
                    (
                        [file_name] =&gt; file2.jpg
                        [is_file] =&gt; 
                    )

                [2] =&gt; Array
                    (
                        [file_name] =&gt; file3.jpg
                        [is_file] =&gt; 
                    )

            )

        [priority] =&gt; 0
        [message_content] =&gt; This is jsut a test of the personal message system!
        [message_read] =&gt; 0
        [is_favorite] =&gt; 0
        [sender_name] =&gt; Kevin Scott
        [sender_email_address] =&gt; myemail@server.com
        [sender_avatar] =&gt; http://dev.myserver.com/assets/themes/supr/images/avatars/avatar5.jpg
    )

[2] =&gt; stdClass Object
    (
        [message_id] =&gt; 3
        [subject] =&gt; Testing Whatever
        [datetime_sent] =&gt; 1 week
        [attachments] =&gt; 
        [priority] =&gt; 0
        [message_content] =&gt; Testing Message Content
        [message_read] =&gt; 0
        [is_favorite] =&gt; 0
        [sender_name] =&gt; Frank Scott
        [sender_email_address] =&gt; frankscott@testemail.com
        [sender_avatar] =&gt; http://dev.myserver.com/assets/themes/supr/images/avatars/avatar.jpg
    )

[total_unread_messages] =&gt; 3
)
</code></pre>
