The prev() function is an inbuilt function in PHP.
- It is used to return the immediate previous element from an array of the element which is currently pointed by the internal pointer.
- We have already discussed current() function in PHP.
- The current() function is used to return the value of the element which is currently pointed by the internal pointer whereas the prev() function decrements or make the internal pointer to point to the previous element of the currently pointed element.
Parameters: This function accepts a single parameter $array. It is the array of which we want to find the current element.
Return Value: It returns the value of the element in the array which is just before the element which the internal pointer is currently pointing to. If the array is empty then the prev() function returns FALSE.
Below programs illustrate the prev() function in PHP:
Ram Shita Ram
a 2 z 2
- PHP | SplDoublyLinkedList prev() Function
- How to get the function name inside a function in PHP ?
- PHP | max( ) Function
- D3.js | d3.min() function
- PHP | min( ) Function
- CSS | rgb() Function
- p5.js | box() Function
- D3.js | d3.map.set() Function
- p5.js | hex() function
- p5.js | str() function
- CSS | var() Function
- PHP | key() Function
- PHP | pos() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.