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 Arrays Vergleichen

Empfohlene Antworten

Veröffentlicht

Hi Leutz

Ich habe folgendes Problem:

Ich möchte zwei Arrays vergleichen, die beide die gleichen Dimensionen und auch Abmessungen haben. Wie würdet ihr das am geschicktesten lösen?

Danke schonmal für eure Hilfe

Hallo,

da du nicht schreibst, was dein Ergebniss nach dem Vergleich sein soll, würde ich sagen, nimm: array_diff()

array array_diff ( array array1, array array2 [, array ...])

returns an array containing all the values of array1 that are not present in any of the other arguments. Note that keys are preserved.

Gruß Jaraz

danke schonmal... war wohl zu blind um die Funktion auf PHP.net zu finden :(

Ich möchte die "Zeilen" herausfinden, in denen sich die beiden Arrays unterscheiden und dann abhängig davon, wie sie sich unterscheiden, ein Datenbankinsert, -update oder -delete machen.

Ich experimentiere dann hier mal etwas herum und melde mich, wenn es nict klappen sollte...

vielen Danke nochmals

Notfalls baust du einfach ne Schleife, in der du einen Zähler hochzählst, den du bei beiden Arrays als Index benutzt - so kannst du immer jeweils die gleichen Zeilen in beiden Arrays vergleichen, und wenn sie nicht gleich sind, etwas anderes ausführen...

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.