title: Checking during array iteration, if the current element is the last element
body: <p>Please help me to translate this pseudo-code to real php code:</p>
  
  <pre><code> foreach ($arr as $k =&gt; $v)
      if ( THIS IS NOT THE LAST ELEMENT IN THE ARRAY)
          doSomething();
  </code></pre>
  
  <p>Edit: the array may have numerical or string keys</p>