Explain foreach loop in php

This question already has an answer here:

  • How does PHP 'foreach' actually work? 7 answers

  • 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, ie 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.

    链接地址: http://www.djcxy.com/p/53036.html

    上一篇: 如何检查变量是否是数组?

    下一篇: 在PHP中解释foreach循环