回答編集履歴
3
4
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
$user = array();
|
10
10
|
|
11
|
-
for ($i=0; $i<count($rows); $i++) {
|
11
|
+
foreach ($i=0; $i<count($rows); $i++) {
|
12
12
|
|
13
13
|
$user[$csv_header[$i]] = $rows[$i];
|
14
14
|
|
2
2
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
$user = array();
|
10
10
|
|
11
|
-
for
|
11
|
+
for ($i=0; $i<count($rows); $i++) {
|
12
12
|
|
13
13
|
$user[$csv_header[$i]] = $rows[$i];
|
14
14
|
|
1
1
test
CHANGED
@@ -19,3 +19,25 @@
|
|
19
19
|
}
|
20
20
|
|
21
21
|
```
|
22
|
+
|
23
|
+
--- 追記 ---
|
24
|
+
|
25
|
+
ループを使わない方法
|
26
|
+
|
27
|
+
```php
|
28
|
+
|
29
|
+
private function get_csv_user($rows, $csv_header)
|
30
|
+
|
31
|
+
{
|
32
|
+
|
33
|
+
return array(
|
34
|
+
|
35
|
+
$csv_header[0]=>$rows[0],
|
36
|
+
|
37
|
+
$csv_header[1]=>$rows[1],
|
38
|
+
|
39
|
+
$csv_header[2]=>$rows[2]);
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
```
|