Best way to get last element of an array w/o deleting it?
<p>Ok,</p>

<p>I know all about <a href="http://www.php.net/array_pop"><code>array_pop()</code></a>, but that deletes the last element.  What's the best way to get the last element of an array without deleting it?</p>

<p>EDIT: 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>
