title: How to get the last element of an array without deleting it?
body: <p>Ok,</p>
  <p>I know all about <a href="http://www.php.net/array_pop" rel="nofollow noreferrer"><code>array_pop()</code></a>, but that deletes the last element.  How to get the last element of an array without deleting it?</p>
  <p>Here's a bonus:</p>
  <pre><code>$array = array('a' =&gt; 'a', 'b' =&gt; 'b', 'c' =&gt; 'c');
  </code></pre>
  <p>or even</p>
  <pre><code>$array = array('a', 'b', 'c', 'd');
  unset($array[2]);
  echo $array[sizeof($array) - 1]; // Output: PHP Notice:  Undefined offset:  2 in - on line 4
  </code></pre>