Can somebody explain foreach loop in php? I know so many answers are available but am not able to understand what the actual mean and use of this.please explain in simple language.
Asked
Active
Viewed 264 times
-11
-
https://stackoverflow.com/questions/10057671/how-does-php-foreach-actually-work – TarangP Dec 18 '17 at 10:21
-
https://stackoverflow.com/help/how-to-ask – dda Dec 18 '17 at 10:22
-
1Go [Here](http://php.net/manual/en/control-structures.foreach.php) – GYaN Dec 18 '17 at 10:22
1 Answers
0
It's simple, foreach loop is meant to loop through arrays. By setting an array elements, on every single pass through them foreach loop asigns next element value in the array to $value, i.e. it takes the value of an array element and passes it to a 'basket' calld $value, which in turn, when invoked, it takes that value from the basket and prints it on the screen.

Sean Bean
- 85
- 10