title: What's the most efficient way to array_pop() the last n elements in an array?
body: <p>What's an efficient way to pop the last <em>n</em> elements in an array?</p>
  
  <p>Here's one:</p>
  
  <pre><code>$arr = range(1,10);
  $n = 2;
  $popped_array = array();
  for ($i=0; $i &lt; $n; $i++) { 
      $popped_array[] = array_pop($arr);
  }
  print_r($popped_array); // returns array(10,9);
  </code></pre>
  
  <p>Is there a more efficient way?</p>