PHP foreach construct ?

for each construct works only on arrays. The foreach looping is the best way to access each key value pair from an array.

For each (array_expr as $key => $value)


array_expr is an array. In every loop the value of the current element of the array is assigned to $value and the internal array pointer is advanced by one and the process continue to reach the last array element.

foreach construct program.
 $fruits = array ("Orange", "Apple", "Banana", "Cherry", Mango");
 foreach ( $fruits as $value )
 echo "$value<br />";