title: PHP - Looping through an object keys, one cycle per key
body: <p>I have this object containing one row and many keys/variables with numbered names. 
  I need to pass each of them one at a time to another function. How do I loop through the keys instead of the rows? </p>
  
  <p>The code would look like this:</p>
  
  <pre><code>foreach ($object['id'] as $row):
  $i++;
  $data['myInfo'][$i] = $this-&gt;get_data-&gt;getInfo('data1', 'id', $row-&gt;{'info'.$i.'_id'});`
  </code></pre>
  
  <p>but this obviously won't work since it's looping through the rows/instances of an object, and I have only one row in my <code>$object['id']</code> object (with <code>info1_id</code>, <code>info2_id</code>, <code>info3_id</code>, <code>info4_id</code>... etc keys), so the loop stops after just one cycle. And I really don't feel like typing all of that extra code by hand, there's gotta be solution for this. :)</p>