title: Getting last 5 elements of a php array
body: <p>How can I get the last 5 elements of a PHP array?</p>
  
  <p>My array is dynamically generated by a MySQL query result. The length is not fixed. If the length is smaller or equal to 5, then get all, else the last 5.</p>
  
  <p>I tried the PHP functions <code>last()</code> and <code>array_pop()</code> but they return only the last element.</p>