質問編集履歴
2
追加質問
title
CHANGED
File without changes
|
body
CHANGED
@@ -21,4 +21,19 @@
|
|
21
21
|
|
22
22
|
のように、重複しているIDの行を一つ残し削除+massageの内容を残った一つの中にすべて格納するような仕組みを作りたいです。
|
23
23
|
|
24
|
-
なおフレームワークとしてlaravelを使用しているのでlaravelのメソッドも使用可能です。
|
24
|
+
なおフレームワークとしてlaravelを使用しているのでlaravelのメソッドも使用可能です。
|
25
|
+
|
26
|
+
|
27
|
+
追記
|
28
|
+
上記の通り比較するのはidが重複するもので、結合するのはmassageだとして他にnameやcolorなど多数のの列が加わる(idが同じの場合nameやcolorも必ず同じ値になり、違うのはmassageのみ)の場合の書き方も教えていただけると幸いです。
|
29
|
+
|
30
|
+
```ここに言語を入力
|
31
|
+
$array= [
|
32
|
+
['id' => 1, 'name' => '東京, 'color' => '黒', 'massage' => '●メッセージ1'],
|
33
|
+
['id' => 1, 'name' => '東京, 'color' => '黒', 'massage' => '●メッセージ2'],
|
34
|
+
['id' => 1, 'name' => '東京, 'color' => '黒', 'massage' => '●メッセージ3'],
|
35
|
+
['id' => 2, 'name' => '新宿, 'color' => '赤', 'massage' => '●メッセージ1'],
|
36
|
+
['id' => 2, 'name' => '新宿, 'color' => '赤', 'massage' => '●メッセージ2'],
|
37
|
+
['id' => 3, 'name' => '品川, 'color' => '青', 'massage' => '●メッセージ1'],
|
38
|
+
];
|
39
|
+
```
|
1
配列の内容を変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,9 +5,7 @@
|
|
5
5
|
['id' => 1, 'massage' => '●メッセージ3'],
|
6
6
|
['id' => 2, 'massage' => '●メッセージ1'],
|
7
7
|
['id' => 2, 'massage' => '●メッセージ2'],
|
8
|
-
['id' => 2, 'massage' => '●メッセージ3'],
|
9
8
|
['id' => 3, 'massage' => '●メッセージ1'],
|
10
|
-
['id' => 3, 'massage' => '●メッセージ2'],
|
11
9
|
];
|
12
10
|
|
13
11
|
```
|
@@ -16,8 +14,8 @@
|
|
16
14
|
```ここに言語を入力
|
17
15
|
$array= [
|
18
16
|
['id' => 1, 'massage' => '●メッセージ1●メッセージ2●メッセージ3'],
|
19
|
-
['id' => 2, 'massage' => '●メッセージ1●メッセージ2●メッセージ3'],
|
20
|
-
['id' =>
|
17
|
+
['id' => 2, 'massage' => '●メッセージ1●メッセージ2'],
|
18
|
+
['id' => 3, 'massage' => '●メッセージ1'],
|
21
19
|
];
|
22
20
|
```
|
23
21
|
|