English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The prev() function moves the internal pointer of the array back one position
prev ($array);
The prev() function returns the value of the array at the previous position pointed to by the internal array pointer, or FALSE if there are no other elements.
prev() and next() behave similarly, except that it moves the internal pointer back one position instead of forward one.
Serial Number | Parameters and Description |
---|---|
1 | array(Required) It specifies an array |
Returns the value of the previous element within the array, or FALSE if there are no more elements.
<?php $input = array('foot', 'bike', 'car', 'plane'); $mode = current($input); print "$mode <br />"; $mode = prev($input); print "$mode <br />"; ?>Test and See‹/›
Output Result:
foot