I'm reading a flie with essentially upwards of ~500,000 lines separated out by | for the columns which I am parsing and trying to insert into the database through the CLI.. Is there a better way to read it in so I can use it?
Currently I'm inserting it as :
$fd = fopen ($txtFileName, "r");
while (!feof ($fd)) {
$buffer = fgets($fd);
$lines[] = $buffer;
}
fclose ($fd);
$i=0;
#hearder keys $t = $lines[1];
$keys = explode('|',$t);
However I'm starting to run out of memory with the larger files.. Any help would be appreciated. Thank you