next() Definition and Usage
next() function moves the pointer pointing to the current element to the position of the next element and returns the value of the element.
If the internal pointer has exceeded the last element of the array, the function returns false.
Syntax
next(array) Parameter Description
array Required. Specifies the array to use.
Explanation
next() behaves similarly to current() with one difference, moving the internal pointer forward one bit before returning the value. This means that it returns the value of the next array element and moves the array pointer forward one position. If the result of moving the pointer is beyond the end of the array element, next() returns FALSE.
Note: If the array contains empty cells, or the value of the cell is 0, this function will also return FALSE when encountering these cells. To correctly iterate over an array that may contain empty cells or a cell value of 0, see the each() function.
Example