How to search for value then delete that line in csv file
-
15-04-2021 - |
سؤال
I don't know if it should be here but, I'm using this
$filepath = 'export/subscriberslist.csv';
$this->directory->create('export');
$stream = $this->directory->openFile($filepath, 'w+');
$stream->lock();
$header = ['Id', 'Email', 'Grupo'];
$stream->writeCsv($header);
And with variables with a foreach writing newsletter subscribers emails and group, but some of them don't have an email, so I wanted, in the end of the write, to search for the lines that has no email then delete that lines so they don't pollute the csv with lines with no info at all.
How can I do this?
Thanks for your time, Rui Silva
لا يوجد حل صحيح
لا تنتمي إلى magento.stackexchange