Wissensportal
PHP
<?php
$tiere = ["Wal", "Gans", "Affe", "Nashorn", "Zebra", "Esel"];
foreach ($tiere as $tier) {
echo $tier . "\n";
}
?>
PHP (Alternative Syntax)
<?php
$tiere = ["Wal", "Gans", "Affe", "Nashorn", "Zebra", "Esel"];
?>
<?php foreach ($tiere as $tier): ?>
<?php echo $tier . "\n"; ?>
<?php endforeach; ?>
Python
tiere = ["Wal", "Gans", "Affe", "Nashorn", "Zebra", "Esel"]
#0 #1 #2 #3 #4 #5
for tier in tiere:
print(tier)