endを使えばいいと思う。
PHP: end - Manual
<?php $arr1 = array(1, 2, 3, 4); $arr2 = array(); $arr2['hoge']['hoge'] = 'hoge'; $arr2['foo']['foo'] = 'foo'; $arr2['bar']['bar'] = 'bar'; $last = end($arr1); print_r($last . PHP_EOL); $last = end($arr2); print_r($last . PHP_EOL);
多次元配列もいけるよ。