This function acts on an array as current() does but first moves the array’s pointer ahead one element. So it moves forward one and returns the value there. Returns false if pointing past the end of the array (or if array is empty).

Remembering that the pointer start off at the first element, calling next() first thing will return the second element’s value (and will leave the pointer at the second element).

$arr = array('apple',
             'banana',
             'carrot');
$one = next($arr); // banana
$two = next($arr); // carrot
 
$arr[] = 'durian';
$arr[] = 'eggplant';
$three = next($arr); // durian
 
foreach($arr as $food) {
  echo "I like $food sometimes\n";
}
$four = next($arr); // false