PHP: Direct access to an element in an array of objects
<p>I am trying to output a set of data, and I have, due to my <code>LEFT OUTER JOIN</code> got multiple rows per match.</p>

<p>I'm using a positive look ahead to see if the next row is the same id as the first. However the return from the database class returns an array of objects.</p>

<pre><code>array(7) {
          [0]=&gt; object(stdClass)#4 (8) {
                                      ["dom_id"]=&gt;string(1) "3"
                                      ["domain"]=&gt;string(11) "example.com"
                                      ["status"]=&gt;string(7) "Invalid"
                                      ["expiry"]=&gt;string(10) "2010-07-20"
                                      ["remaining"]=&gt;string(6) "0 Days"
                                      ["rem_id"]=&gt;NULL
                                      ["alert_type"]=&gt;NULL
                                      ["contact"]=&gt;NULL
  }
//etc
</code></pre>

<p>I am getting the following error, <code>Fatal error: Cannot use object of type stdClass as array</code></p>

<p>My code is as follows, </p>

<pre><code>echo $domains[$k+1]-&gt;alert_type;
</code></pre>

<p>I know that I could assign the new dimension to a variable and access that as an object, but for the sake of neatness I'd rather access it directly.</p>

<p>Is this possible? ..and if it is, how do I approach it?</p>

<p>Ta</p>
