Ich erstelle ein Benachrichtigungssystem. Das unten gezeigte Ergebnis gibt alle Benachrichtigungen für einen bestimmten Benutzer zurück. Ich möchte das Array nach "notify_id" gruppieren und jedes Element in einer Gruppe zählen.PHP-Gruppe nach Wert und Anzahl Gruppenelement
so, dass ich haben werde:
"Jack Bill folgt jetzt Sie", John Doe auf Ihrem Beitrag 2" kommentierte: "John Doe und 2 andere kommentiert Ihren Beitrag 1"
Array ([0] =>
Array ([id] => 1
[user_id] => 10
[type] => follow
[notify_id] => 13
[notify_date] => 1483444712
[firstname] => Jack
[surname] => Bill
[picture] =>)
[1] =>
Array ([id] => 10
[user_id] => 10
[type] => comment
[notify_id] => 2
[notify_date] => 1482159309
[firstname] => John
[surname] => Doe
[picture] =>)
[2] =>
Array ([id] => 8
[user_id] => 10
[type] => comment
[notify_id] => 1
[notify_date] => 1482159219
[firstname] => John
[surname] => Doe
[picture] =>)
[3] =>
Array ([id] => 6
[user_id] => 16
[type] => comment
[notify_id] => 1
[notify_date] => 1482159129
[firstname] => James
[surname] => Canon
[picture] =>)
[4] =>
Array ([id] => 5
[user_id] => 14
[type] => comment
[notify_id] => 1
[notify_date] => 1482159079
[firstname] => Sharon
[surname] => Abba
[picture] =>) )
Und was ist Ihre Frage? –
Warum erhalten Sie die Daten nicht in dem von Ihnen benötigten Format, unabhängig davon, wo Sie sie speichern? – Kisaragi
Wie ziehst du diese Arrays? Wenn Sie sie mit 'notify_id' gruppieren möchten, sollten Sie dies in Ihrer Anfrage tun. – WillardSolutions