I l@ve RuBoard Previous Section Next Section

next

mixed next(array array) 

Advances the internal array pointer to the next element and returns that element's value.

Returns:

Contents of the next element in the array; FALSE when there are no more elements

Description:

This function advances the internal array pointer to the next element of array and returns that element's value. This can be useful with current() and prev() to traverse an array; however, this is dangerous. The reason is that next() returns the value of the element found; if this evaluates to FALSE, there is no way to tell whether you've actually hit the end of the array being traversed, or the next element simply has a value of FALSE.

Version:

PHP 3, PHP 4

See also:

end() 
key() 
current() 
prev() 
reset() 

Example:

Advance the internal array pointer
$my_array = array('a', 'b', 'c', 'd', 'e'); 
echo current($my_array); 
for ($i = count($my_array); $i >= 0; $i--) {
   echo "\n" . next($my_array); 
} 

Output: 
a 
b 
c 
d 
e 
    I l@ve RuBoard Previous Section Next Section