Fix "Strict Standards: Only variables should be passed by reference"

PHP 5.4 introduces a warning when using `E_STRICT`. Calls to `end()`
are therefor replaced with the (admittedly rather silly) series of calls
to `current(array_reverse($array))`, instead.