|
|
$a = array( 1, 2, 3, 10 );
foreach( $a as $b ) {
echo "$b<br>";
}
| |
|
|
配列のかわりに変数を使用したい場合
list($a,$b,$c,$d) = array( 1, 2, 3, 10 );
echo $a,$b,$c,$d;
| |
|
|
|
|
$a = array( "001" => 1, "002" => 2, "003" => 3, "010" => 10 );
foreach( $a as $b => $c ) {
echo "$a[$b]<br>";
echo "$b<br>";
echo "$c<br>";
}
| |
|
|
|
|
$a[0] = 1;
$a[1] = 2;
$a[2] = 3;
$a[3] = 10;
foreach( $a as $b ) {
echo "$b<br>";
}
| |
|
|
|