The pos() is an inbuilt function in PHP which is used to return the value of the element in an array which the internal pointer is currently pointing to. The pos() function does not increment or decrement the internal pointer after returning the value. In PHP all arrays have an internal pointer. This internal pointer points to some element in that array which is called as the current element of the array. Usually, the current element is the first inserted element in the array.
Parameters: The pos() 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 the internal pointer is currently pointing to. If the array is empty then the pos() function returns FALSE.
Below programs illustrate the pos() function in PHP:
Ram Shyam Shyam Ram Rita Rita
P 6 6 P F F
- How to get the function name inside a function in PHP ?
- p5.js | max() function
- p5.js | log() function
- D3.js | d3.min() function
- PHP | Ds\Map first() Function
- p5.js | second() function
- PHP | Ds\Set first() Function
- PHP | each() Function
- p5.js | nf() Function
- p5.js | tan() function
- p5.js | sin() function
- p5.js | cos() 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.