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 ?
- p5.js | tan() function
- D3.js | d3.sum() function
- PHP | Ds\Set xor() Function
- PHP | exp() Function
- PHP | Ds\Map map() Function
- PHP | dir() Function
- p5.js | max() function
- p5.js | sin() function
- p5.js | second() function
- p5.js | cos() function
- PHP | each() 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.