質問編集履歴
6
抜け修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,6 +80,8 @@
|
|
80
80
|
|
81
81
|
array (
|
82
82
|
|
83
|
+
'id' => '1',
|
84
|
+
|
83
85
|
'name' => 'hogehoge',
|
84
86
|
|
85
87
|
'gender' => '男性',
|
@@ -111,6 +113,8 @@
|
|
111
113
|
'nameinfo' =>
|
112
114
|
|
113
115
|
array (
|
116
|
+
|
117
|
+
'id' => '2',
|
114
118
|
|
115
119
|
'name' => 'hogehoge2',
|
116
120
|
|
@@ -144,6 +148,8 @@
|
|
144
148
|
|
145
149
|
array (
|
146
150
|
|
151
|
+
'id' => '3',
|
152
|
+
|
147
153
|
'name' => 'hogehoge3',
|
148
154
|
|
149
155
|
'gender' => '男性',
|
5
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,11 +14,11 @@
|
|
14
14
|
|
15
15
|
```PHP
|
16
16
|
|
17
|
-
$hogename[] = array('id'=>1,'name'=>'hogehoge',gender=>'男性');
|
17
|
+
$hogename[] = array('id'=>1,'name'=>'hogehoge','gender'=>'男性');
|
18
18
|
|
19
|
-
$hogename[] = array('id'=>2,'name'=>'hogehoge2',gender=>'女性');
|
19
|
+
$hogename[] = array('id'=>2,'name'=>'hogehoge2','gender'=>'女性');
|
20
20
|
|
21
|
-
$hogename[] = array('id'=>3,'name'=>'hogehoge3',gender=>'男性');
|
21
|
+
$hogename[] = array('id'=>3,'name'=>'hogehoge3','gender'=>'男性');
|
22
22
|
|
23
23
|
|
24
24
|
|
4
全角、半角数字の訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
$hogename[] = array('id'=>1,'name'=>'hogehoge',gender=>'男性');
|
18
18
|
|
19
|
-
$hogename[] = array('id'=>
|
19
|
+
$hogename[] = array('id'=>2,'name'=>'hogehoge2',gender=>'女性');
|
20
20
|
|
21
21
|
$hogename[] = array('id'=>3,'name'=>'hogehoge3',gender=>'男性');
|
22
22
|
|
@@ -96,7 +96,7 @@
|
|
96
96
|
|
97
97
|
1 => '皮の服',
|
98
98
|
|
99
|
-
|
99
|
+
2 => '鉄の鎧'
|
100
100
|
|
101
101
|
),
|
102
102
|
|
@@ -128,7 +128,7 @@
|
|
128
128
|
|
129
129
|
1 => '鉄の服',
|
130
130
|
|
131
|
-
|
131
|
+
2 => '鉄鉄の鎧'
|
132
132
|
|
133
133
|
),
|
134
134
|
|
@@ -160,7 +160,7 @@
|
|
160
160
|
|
161
161
|
1 => '鋼の服',
|
162
162
|
|
163
|
-
|
163
|
+
2 => '鋼の鎧'
|
164
164
|
|
165
165
|
),
|
166
166
|
|
3
パターンの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,9 +16,17 @@
|
|
16
16
|
|
17
17
|
$hogename[] = array('id'=>1,'name'=>'hogehoge',gender=>'男性');
|
18
18
|
|
19
|
+
$hogename[] = array('id'=>2,'name'=>'hogehoge2',gender=>'女性');
|
20
|
+
|
21
|
+
$hogename[] = array('id'=>3,'name'=>'hogehoge3',gender=>'男性');
|
22
|
+
|
19
23
|
|
20
24
|
|
21
25
|
$itemlist[] = array('id'=>1,'iteminfo' => array('木の枝','皮の服','鉄の鎧'));
|
26
|
+
|
27
|
+
$itemlist[] = array('id'=>2,'iteminfo' => array('鉄の枝','鉄の服','鉄鉄の鎧'));
|
28
|
+
|
29
|
+
$itemlist[] = array('id'=>3,'iteminfo' => array('鋼の枝','鋼の服','鋼の鎧'));
|
22
30
|
|
23
31
|
|
24
32
|
|
@@ -96,4 +104,68 @@
|
|
96
104
|
|
97
105
|
)
|
98
106
|
|
107
|
+
|
108
|
+
|
109
|
+
array (
|
110
|
+
|
111
|
+
'nameinfo' =>
|
112
|
+
|
113
|
+
array (
|
114
|
+
|
115
|
+
'name' => 'hogehoge2',
|
116
|
+
|
117
|
+
'gender' => '女性',
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
),
|
122
|
+
|
123
|
+
'iteminfo' =>
|
124
|
+
|
125
|
+
array (
|
126
|
+
|
127
|
+
0 => '鉄の枝',
|
128
|
+
|
129
|
+
1 => '鉄の服',
|
130
|
+
|
131
|
+
2 => '鉄鉄の鎧'
|
132
|
+
|
133
|
+
),
|
134
|
+
|
135
|
+
),
|
136
|
+
|
137
|
+
)
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
array (
|
142
|
+
|
143
|
+
'nameinfo' =>
|
144
|
+
|
145
|
+
array (
|
146
|
+
|
147
|
+
'name' => 'hogehoge3',
|
148
|
+
|
149
|
+
'gender' => '男性',
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
),
|
154
|
+
|
155
|
+
'iteminfo' =>
|
156
|
+
|
157
|
+
array (
|
158
|
+
|
159
|
+
0 => '鋼の枝',
|
160
|
+
|
161
|
+
1 => '鋼の服',
|
162
|
+
|
163
|
+
2 => '鋼の鎧'
|
164
|
+
|
165
|
+
),
|
166
|
+
|
167
|
+
),
|
168
|
+
|
169
|
+
)
|
170
|
+
|
99
171
|
```
|
2
不足点追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -19,6 +19,10 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
$itemlist[] = array('id'=>1,'iteminfo' => array('木の枝','皮の服','鉄の鎧'));
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
$i = 0;
|
22
26
|
|
23
27
|
|
24
28
|
|
1
1つにしたい配列の追加、試してみたコードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,6 +7,54 @@
|
|
7
7
|
質問文が拙いですがお力を貸していただけると嬉しいです。
|
8
8
|
|
9
9
|
よろしくお願いします。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
下記の配列を1つのものとしたい
|
14
|
+
|
15
|
+
```PHP
|
16
|
+
|
17
|
+
$hogename[] = array('id'=>1,'name'=>'hogehoge',gender=>'男性');
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
$itemlist[] = array('id'=>1,'iteminfo' => array('木の枝','皮の服','鉄の鎧'));
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
foreach ($hogename as $hogenamez) {
|
26
|
+
|
27
|
+
foreach ($itemlist as $itemlistz) {
|
28
|
+
|
29
|
+
if ($hogenamez['id'] == $itemlistz['id'] ) {
|
30
|
+
|
31
|
+
$list[$i] = array(
|
32
|
+
|
33
|
+
'nameinfo' => $hogenamez,
|
34
|
+
|
35
|
+
'iteminfo' => array(
|
36
|
+
|
37
|
+
$itemlistz['iteminfo']
|
38
|
+
|
39
|
+
)
|
40
|
+
|
41
|
+
);
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
$i ++;
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
idが同じなのでhogehogeさんの持ち物として下記のような結果が得られるようにしたい
|
10
58
|
|
11
59
|
|
12
60
|
|