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 | nfs() Function
- D3.js now() function
- PHP | Ds\Map first() Function
- p5.js | nfp() Function
- p5.js | nfc() function
- p5.js | nf() Function
- PHP | exp() Function
- D3.js | d3.set.add() Function
- CSS | var() Function
- p5.js | box() Function
- PHP | next() Function
- PHP | Ds\Map xor() Function
- CSS max() Function
- D3.js | d3.sum() function
- PHP | Ds\Set xor() 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.