PHP Programs

program using for each statement

In this program we demonstrate use of for each loop.  how to use for each loop in program we will see in this program






foreach($array as $value)


  echo"value is $value <br/>";





When Run The Program Following Output:

value is 1

value is 2

value is 3

value is 4

value is 5


For each loop is used for iterate through array values

Syntax of for each loop :


foreach($variable  as $arr_values)


block of code to be executed


Releted Programs

© 2017 codewmAll rights reserved.