prev() Definition and Usage
prev() function moves the pointer pointing to the current element to the position of the previous element and returns the element value.
If the internal pointer has passed before the first element of the array, the function returns false.
Syntax
prev(array) Parameter Description
array Required. Specifies the array to use.
Explanation
prev() behaves similarly to next(), except that it rewinds the internal pointer one position instead of moving it forward.
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