Voll Upload SGD Fachinformatiker PHP
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
$geradeZahlen = [];
|
||||
$element = 0;
|
||||
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
if ($i % 2 == 0) {
|
||||
$geradeZahlen[$element] = $i;
|
||||
$element++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
echo "<ol>";
|
||||
foreach ($geradeZahlen/*Name des Array*/ as $schluessel=>$wert) {
|
||||
echo "<li> Das Element mit dem Index $schluessel hat den Wert <b>$wert</b>.</li>";
|
||||
}
|
||||
/* foreach (array as Index => Wert)
|
||||
oder
|
||||
foreach (array as wert) ...Ausgabe ohne Index
|
||||
*/
|
||||
echo "</ol>"
|
||||
?>
|
||||
Reference in New Issue
Block a user