The each() function is an inbuilt function in PHP which basically returns an array with four elements, two elements (1 and Value) for the element value, and two elements (0 and Key) for the element key and moves the cursor forward.
Array: It specifies the array which is being taken as input and used for each() function.
It returns the current element key and value which are an array with four elements out of which two elements (1 and Value) for the element value, and two elements (0 and Key) for the element key.It returns FALSE if there are no array elements.
Let’s see PHP program:
Array (  => Ram [value] => Ram  => 0 [key] => 0 ) Array (  => Shita [value] => Shita  => 1 [key] => 1 )
Array (  => Ram [value] => Ram  => 101 [key] => 101 ) Array (  => Geeta [value] => Geeta  => 105 [key] => 105 )
- How to get the function name inside a function in PHP ?
- PHP | tan( ) Function
- CSS | var() Function
- D3.js | d3.lab() Function
- D3.js | d3.map.set() Function
- D3.js | d3.hcl() Function
- p5.js | max() function
- PHP | cos( ) Function
- PHP | pos() Function
- PHP | key() Function
- PHP | sin( ) Function
- p5.js | second() function
- p5.js | abs() 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 email@example.com. 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.