Get first or last element from PHP array()

$stack = array("orange", "banana", "apple", "raspberry");
$last_value = array_pop($stack); // return "raspberry"
$first_value = array_shift(array_values($stack)); // return "orange"