php7-mysql-data/Kapitel_2/Lektion_10/4_foreach.php
2016-08-21 00:15:10 +02:00

27 lines
407 B
PHP

<?php
$person = [
'vorname' => 'Max',
'nachname' => 'Muster',
'strasse' => 'Musterstraße 1'
];
foreach ($person as $wert) {
var_dump($wert);
echo '<br>';
}
echo '<ul>';
foreach ($person as $wert) {
echo '<li>' . $wert . '</li>';
}
echo '</ul>';
echo '<ul>';
foreach ($person as $schluessel => $wert) {
echo '<li>' . $schluessel . ': ' . $wert . '</li>';
}
echo '</ul>';