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 February 14, 2024 16:56
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