title: How to access stdClass Object array in codeigniter
body: <p>I have following <code>print_r ($rolePermissions);</code> array result and wondering how can i access only <code>permID</code>dynamically.</p>
  
  <pre><code> Array ( [0] =&gt; Array ( [0] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 1 ) [1] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 2 ) [2] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 3 ) [3] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 4 ) [4] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 5 ) [5] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 6 ) [6] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 7 ) [7] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 8 ) [8] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 9 ) [9] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 10 ) [10] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 11 ) [11] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 12 ) [12] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 13 ) [13] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 14 ) [14] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 15 ) [15] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 16 ) [16] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 17 ) [17] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 18 ) [18] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 19 ) [19] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 20 ) [20] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 21 ) [21] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 22 ) [22] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 23 ) [23] =&gt; stdClass Object ( [roleID] =&gt; 1 [permID] =&gt; 24 ) ) [1] =&gt; Array ( [0] =&gt; stdClass Object ( [roleID] =&gt; 2 [permID] =&gt; 2 ) [1] =&gt; stdClass Object ( [roleID] =&gt; 2 [permID] =&gt; 3 ) [2] =&gt; stdClass Object ( [roleID] =&gt; 2 [permID] =&gt; 4 ) ) [2] =&gt; Array ( [0] =&gt; stdClass Object ( [roleID] =&gt; 3 [permID] =&gt; 4 ) ) [3] =&gt; Array ( ) ) 
  </code></pre>
  
  <p>I am accessing with following code: </p>
  
  <pre><code>$rolePermission[0]-&gt;permID
  </code></pre>
  
  <p>But i am unable to get all the records because results can be varied each time and index 0 is not feasible way to do this. It displays some records and pop up errors in others.</p>
  
  <pre><code>Error messages:
  Undefined offset: 0
  Message: Trying to get property of non-object
  </code></pre>
  
  <p>any help ?</p>