普通のarrayの場合
$arr = array(1,2,3,4,5); foreach($arr as $a) { echo $a.'<br>'; }
連想配列の場合
$key =>
は省略可能.
$a_arr = array( 'a' => 1, 'b' => 2, 'c' => 3 ); foreach($a_arr as $key => $value) { echo $key.':'.$value; }
$arr = array(1,2,3,4,5); foreach($arr as $a) { echo $a.'<br>'; }
$key =>
は省略可能.
$a_arr = array( 'a' => 1, 'b' => 2, 'c' => 3 ); foreach($a_arr as $key => $value) { echo $key.':'.$value; }