This function is opposite reset(). It puts the array’s pointer at the last element and also returns the value of that element. It returns false for an empty array.

$arr = array('apple',
             'banana',
             'carrot');
$one   = current($arr); // apple
$two   = end($arr);     // carrot
$three = current($arr); // carrot
 
foreach($arr as $food) {
  echo "I like $food sometimes\n";
}
$four = current($arr); // false
$five = end($arr);     // carrot