Considering i have a 100GB txt file containing millions of lines of text. How could i read this text file by block of lines using PHP?
i can\'t use file_get_
I would recommend implementing the reading of a single line within a function, hiding the implementation details of that specific step from the rest of your code - the processing function must not care how the line was retrieved. You can then implement your first version using fgets()
and then try other methods if you notice that it is too slow. It could very well be that the initial implementation is too slow, but the point is: you won't know until you've benchmarked.