title: Alternative to foreach() PHP?
body: <p>I am still very new to PHP and from all the examples that are around they all seem to use foreach statements.</p>
  
  <p>e.g.</p>
  
  <pre><code>foreach ($variable as $row)
  </code></pre>
  
  <p>However I don't think I should be using this all the time, for example variables or objects I have an which only has one row or instance in an array.</p>
  
  <p>I know its advantageous to use them for multiple rows which could be missed if you used a for loop.</p>
  
  <p>But do I really need to use it just to echo one variable thats in an array?</p>
  
  <p>e.g. for example this variable $stats</p>
  
  <pre><code>array(3) { ["user_interventions"]=&gt; int(4) ["fastest_intervention"]=&gt; array(1) { [0]=&gt; object(stdClass)#22 (1) { ["duration"]=&gt; string(8) "02:10:00" } } ["slowest_intervention"]=&gt; array(1) { [0]=&gt; object(stdClass)#23 (1) { ["duration"]=&gt; string(8) "02:26:00" } } } 
  </code></pre>
  
  <p>Thanks</p>