Concept

How are foreach loops used to iterate over array elements in PHP?

ComputerScienceOne / Do-While Loops

"39.4. Foreach Loops\n\nFinally, PHP supports foreach loops using the keyword foreach. Some of this will be a preview of Section 42 where we discuss arrays in PHP. In short you can iterate over the elements of an array as follows.\n\n$arr = array(1.41, 2.71, 3.14);\n\nforeach($arr as $x) {\n\n//x now holds the \"current\" element in arr\n\nActually, PHP supports associative arrays, which are not the same thing as traditional arrays."

Related Ideas