1foreach (array as $value){
2 //code to be executed;
3 print("value : $value");
4}
5
6foreach (array as $key => $value){
7 //code to be executed;
8 print("key[$key] => $value");
9}
1$ar = ['Rudi', 'Morie', 'Halo', 'Miki'];
2
3for ($i=0, $len=count($ar); $i<$len; $i++) {
4 echo "$ar[$i] \n";
5}
6/*
7Rudi
8Morie
9Halo
10Miki
11*/