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 )
- PHP | each() Function
- How to break _.each() function in Underscore.js ?
- Collect.js | each() Function
- D3.js selection.each() Function
- D3.js node.each() Function
- How to get the function name inside a function in PHP ?
- jQuery | Misc each() Method
- How to display bootstrap carousel with three post in each slide?
- How to place two bootstrap cards next to each other ?
- How to skip to next iteration in jQuery.each() util ?
- Sass @each Rule
- How to Add Image into Dropdown List for each items ?
- How to add unique Id to each record in your local/custom database in Node.js ?
- How to put items underneath each other flex box in Bootstrap 4 ?
- How to place two input box next to each other using Bootstrap 4 ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
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.