Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Operator =>

Empfohlene Antworten

Veröffentlicht

Hallo kann mir jemand den => genauer erklären?

Ich weiß wie man in zum zuweisen von Werten in ein assoziatives array verwendet, aber in folgendem Kontext ist er mir nich ganz klar


$ar["Montag"] = "Wochenanfang";
$ar["Dienstag"] = "Tag des Dienstes";
$ar["Mittwoch"] = "Mitte der Woche?";
$ar["Donnerstag"] = "Tag des Donners";

foreach($ar as $key=>$wert)
echo $key . " - " . $wert . "<br>";

[/PHP]

Das Ding gibt Index und Wert aus, aber warum genau?

erklären ist schlecht, aber ich kann dir anhand eines beispiels zeigen:


$ar["Montag"] = "Wochenanfang";
$ar["Dienstag"] = "Tag des Dienstes";
$ar["Mittwoch"] = "Mitte der Woche?";
$ar["Donnerstag"] = "Tag des Donners";

foreach($ar as $key=>$wert) {
echo $key . " - " . $wert . "<br>";
}

for ( $key = 0; $key < count( $ar); $key++) {
echo $key . " - " . $ar[$key] ."<br>";
}
[/PHP]

Diese beiden schleifen sind quasi äquivalent!

FOR FOREACH

$key entspricht $key

$ar[$key] entsprich $wert

$ar entsprich $ar

Ist halt blöde zu erklären.

Stell dir vor, das die foreach schleife "automatisch" schon das count welches in der For -Schleife (s.o.) ist, intern verwendet. $wert ist in der Foreach schleife eine Temporäre Variable die schon von der Foreach-Schleife selbst mit Werten gefüllt wird.

das "=>" ist in diesem sinne kein Operator.

Es ist ein teil des LanguageConstructs.

Vielleicht sind die erklärungen im Manual besser?

@see http://de2.php.net/manual/de/control-structures.foreach.php

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.