prev () Definition and usage
The prev () function moves a pointer to the current element to the position of the previous element and returns the element value.
The function returns False if the inner pointer has already exceeded the first element of the array.
Grammar
Prev (array) parameter description
Array required. Specifies the array to use.
Description
The behavior of Prev () and Next () is similar, but it returns the internal pointer back to one instead of a forward position.
Note: If the array contains empty cells, or if the value of the cell is 0, the function will also return FALSE if it encounters these cells. To properly traverse an array that may contain empty cells or a cell value of 0, see the each () function.
Example
Copy CodeThe code is as follows:
$people = Array ("Peter", "Joe", "Glenn", "Cleveland");
Echo current ($people). "
";
Echo Next ($people). "
";
Echo prev ($people);
?>
Output:
Peter
Joe
Peter
http://www.bkjia.com/PHPjc/324474.html www.bkjia.com true http://www.bkjia.com/PHPjc/324474.html techarticle The prev () Definition and Usage prev () function moves a pointer to the current element to the position of the previous element and returns the element value. If the inner pointer has exceeded the first element of the array ...