I have a bunch of text files that look something like this:
987654 Example 1
321987 Test 2
654321 Whatever 1
Each column represents a specific value (e.g., ID, timestamp, name, etc.). I'm trying to funnel all of this into a MySQL table. I need to read each line of these files individually and parse what part of each line should go into what column in the row.
Each file contains about 5,000,000 lines. I tried doing a test with just this:
$test = array();
for($i=1;$i<5000000;$i++){
$test[] = '';
}
Even a blank array with that many elements maxes out my memory limit (64mb, it needs to stay at that too because my host doesn't allow anything larger), so turning the file into an array is impossible, and probably a little silly to consider in retrospect. I'm out of my element here because I've never had to do something like this before.
How can I do something like foreach
line in file without using an array?