Skip to content

Instantly share code, notes, and snippets.

View Alimba86's full-sized avatar
🏠
Working from home

Spiros Alimba86

🏠
Working from home
View GitHub Profile
@selwynpolit
selwynpolit / read_csv.php
Last active November 5, 2024 09:38
Php code to read a csv file of any size without exhausting memory and let you process it in chunks
/*
Reads a CSV file in chunks of 10 lines at a time
and returns them in an array of objects for processing.
Assumes the first line of the CSV file has headings
that will be used as the object name for the item you are
processing. i.e. the heading is CurrentURL then refer to
$item->CurrentURL