-11

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.

gati vijay
  • 11
  • 1

1 Answers1

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