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: Eindimensionales Array weiter zerlegen mit explode?

Empfohlene Antworten

Veröffentlicht

Hallo,

Kann man in PHP ein eindimensionales Array mit explode weiter zerlegen (in ein zweidimensionales?).

ich würde gern sowas machen wie:

$bla[0]="5.12";

$bla[0] = explode(".",$bla[0]);

(geht nicht)

rauskommen sollte:

$bla[0][0]="5"

$bla[0][1]="12"

Hmm mein Beispiel funktioniert ja sogar, liegt an einem etwas anderen Problem wenn ich:

$bla[0]="5.12";

$bla[0] = explode(".",$bla[0]);

echo $bla[0][0]; --> Ausgabe:5

echo "$bla[0][0]"; --> Ausgabe:Array[0]

Kann mir jemand erklären, wiso das so ist?

Wenn du mit echo ein Array ausgeben willst, kannst du das nicht wie eine Variable in "" schreiben:

// Sie können auch Arrays nutzen

$bar = array("wert" => "foo");

echo "Das ist {$bar['wert']} !"; // Das ist foo !

EDIT:

Oder du hängst es an den String an:

echo "Das ist ".$bar["wert"]." !";

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.