質問編集履歴

2

修正

2017/06/14 10:41

投稿

ssk
ssk

スコア332

test CHANGED
File without changes
test CHANGED
@@ -86,9 +86,9 @@
86
86
 
87
87
  ```PHP
88
88
 
89
- $file = new SplFileObject($filepath);
89
+ $csvfile = new SplFileObject($filepath);
90
90
 
91
- $file->setFlags(SplFileObject::READ_CSV);
91
+ $csvfile->setFlags(SplFileObject::READ_CSV);
92
92
 
93
93
  foreach ($csvfile as $line) {
94
94
 

1

修正

2017/06/14 10:41

投稿

ssk
ssk

スコア332

test CHANGED
File without changes
test CHANGED
@@ -90,15 +90,15 @@
90
90
 
91
91
  $file->setFlags(SplFileObject::READ_CSV);
92
92
 
93
- foreach ($file as $line) {
93
+ foreach ($csvfile as $line) {
94
94
 
95
- //終端の空行を除く処理 空行の場合に取れる値は後述
95
+ //終端の空行を除く処理 空行の場合に取れる値は後述
96
96
 
97
- if(is_null($line[0]){
97
+ if(!is_null($line[0])){
98
98
 
99
- $records[] = $line;
99
+ $records[] = $line;
100
100
 
101
- }
101
+ }
102
102
 
103
103
  }
104
104