PHP - Get last element of array
Retrieve the last item in an array of elements.
end() advances array's internal pointer to the last element, and returns its value. documentation
Slice back element of array into new array. The first element is taken of this new one element array.
array_pop() pops and returns the last value of the array, shortening the array by one element. If array is empty (or is not an array), NULL will be returned. Will additionally produce a Warning when called on a non-array. documentation