Next () Definition and usage
The next () function moves the pointer to the current element to the position of the next element and returns the value of the element.
If the internal pointer already exceeds the last element of the array, the function returns FALSE.
Grammar
Next (array) parameter description
Array required. Specify the array to use.
Description
The behavior of next () and current () is similar, with only one point of difference, in which the internal pointer is moved forward one bit before the value is returned. This means that it returns the value of the next array cell and moves the array pointer forward one bit. If the result of moving the pointer is beyond the end of the array cell, next () returns FALSE.
Note: If the array contains empty cells, or if the cell value is 0, the function encounters these cells and returns FALSE. To properly traverse an array that may contain empty cells or a cell value of 0, see the each () function.
Example
Copy Code code as follows:
<?php
$people = Array ("Peter", "Joe", "Glenn", "Cleveland");
Echo current ($people). "<br/>";
Echo Next ($people);
?>
Output:
Peter
Joe