通知システムを作成しています。以下に示す結果は、特定のユーザーのすべての通知を返します。私は配列を 'notify_id'でグループ化し、グループ内の各項目を数えたいと思います。Phpグループ値とグループの配列グループ
私が持っているだろうというような:
"ジャック・ビルは今、あなたをフォローしています"、ジョン・ドウはあなたのポスト2" 上のコメント、 "ジョン・ドウとコメント2人の他人 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] =>) )
あなたの質問は何ですか? –
あなたはそれを格納している場所から必要なフォーマットでデータを取得してみませんか? – Kisaragi
どのようにこれらの配列を引っ張っていますか?それらを 'notify_id'でグループ化したいのであれば、あなたのクエリでそれを行うべきです – WillardSolutions