title: php iterate through array of objects inside an array
body: <p>I am trying to loop through all posts in my database and grab their id. Here is what I have so far:</p>
  
  <pre><code>$posts = $db-&gt;select("posts","*",array());
  
  foreach ($posts as $value) {
      $response['postvalue'] = $value;
  }
  </code></pre>
  
  <p>When I run the code above I get this in my console.</p>
  
  <p><a href="https://i.stack.imgur.com/pFcQT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pFcQT.png" alt="enter image description here"></a></p>
  
  <p>inside those objects I have a property 'id'.</p>
  
  <p>When I run this:</p>
  
  <pre><code>$posts = $db-&gt;select("posts","*",array());
  
  foreach ($posts as $value) {
      $response['postvalue'] = $value-&gt;id;
  }
  </code></pre>
  
  <p>I get a null value: </p>
  
  <p><a href="https://i.stack.imgur.com/Yq1C6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yq1C6.png" alt="enter image description here"></a></p>
  
  <p>What am I doing wrong?</p>
  
  <p>UPDATE: </p>
  
  <p><a href="https://i.stack.imgur.com/djzNA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/djzNA.png" alt="enter image description here"></a></p>