PHP For-each Loop With Example

aimtocode

For Each loop

The for each statement is used to loop through arrays. For each pass the value of the current array element is assigned to $value and the array pointer is moved by one and in the next pass next element will be processed.

Syntax:



Example:




Result:


  Value is 11
  Value is 12
  Value is 13
  Value is 14
  Value is 15

Read also:


aimtocode