"php dynamically create csv: skip the first line of a csv file" Answer’s


As you are keeping track of the row number anyway, you can use continue to skip the rest of the loop for the first row.

For example, add this at the start of your while loop (just above $num = count($data)):

if($row == 1){ $row++; continue; }

There are other ways to do this, but just make sure that when you continue, $row is still being incremented or you'll get an infinite loop!

Wednesday, March 31, 2021
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :