emailconfirmed, nsInternRO, nsInternRW, Administrators
3,356
edits
(→Arrays) |
|||
Line 267: | Line 267: | ||
// ...this array | // ...this array | ||
array(5 => 43, 6 => 32, 7 => 56, "b" => 12); | array(5 => 43, 6 => 32, 7 => 56, "b" => 12); | ||
</source> | |||
Elemente eines Arrays können mit der <tt>foreach()</tt> Schleife prima durchlaufen werden, z.B.: | |||
<source lang="PHP"> | |||
// foreach (array_expression as $value) | |||
foreach($myArray as $value) { | |||
echo $value . "<br/>"; | |||
} | |||
// oder: foreach (array_expression as $key => $value) | |||
foreach($myArray as $key => $value) { | |||
echo $key . "=>" . $value . "<br/>" | |||
</source> | </source> | ||