If you're not worried about the array, then you can use the array_pop() function. This will remove the last element, shortening the array by one, and return the contents.
You can also use the count() function to find out the size of the array, and hence the array's size is no longer unknown.
Example:
$temp = array_pop($data);
// or...
$temp = $data[count($data) - 1];
$temp will contain the contents of the last element in the array after either one of those statements. I hope this works for you.
Rubric