When iterating over a csv file using PHP SplFileObject and the READ_CSV flag READ_CSV I get an extra line with a null value, Is there a way to delete this line automatically?
$file = new SplFileObject(__DIR__.'/technologies.csv', 'r'); $file->setFlags(SplFileObject::READ_CSV); foreach ($file as $row) { var_dump($row); }
This will result in a null string.
... array(1) { [0] => NULL }
source share