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.

sort in 2dimensionalen array

Empfohlene Antworten

Veröffentlicht

Ich hab mir das mein bisheriges Wissen in Sachen php über internet hilfen gesucht.

Was dabei rausgekommen ist:

$alles = array(array());

damit möchte ich ein 2dimens. array erzeugen, das ich später "auffülle")

so fülle ich es auf (in einer For-Schleife):

 
$alles[$count][0] = $nachname1;
$alles[$count][1] = $vorname;
$alles[$count][2] = $adresse;
$alles[$count][3] = $nachname2;
[/PHP]

danach möchte ich das zeug sortiert ausgeben, dazu verwende ich:

[PHP]sort($alles);

und gebe das ganze wieder in einer for-schleife aus

Es scheint meine Zwecke soweit zu erfüllen, aber ist das mit de array erzeugen, so wie ich das gemacht habe, ok?

Und ich versteh nicht ganz wie dieses "sort" abläuft. Kann das jemand erklären?

Das ist schon ok...man kann es aber auch weglassen und PHP macht es automatisch solbald du einen solchen Befehl ausführst:

$newArray[5][2] = 'Test';

Nun hat PHP ein 2.dim. Array automatisch angelegt.

Gruß

Freundlicher Nachbar

aha, danke.

Und wie geht der Befehl/die Funktion "sort" vor?

Schau mal hier

Gruß

Freundlicher Nachbar

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.