07-31-2007, 09:59 PM
I've a question regarding performance and a single flat file used to store small, pipe-delimited bits of information about each client; each client is given a seperate line in the file. I was brainstorming for the best way to do this and ingenuity (or so I'm hoping it can still be called that) struck! Instead of reading the whole file into file_get_contents(), or the entire thing into an array with file(), why not set each line to the same length (60, in my case), fopen() the file into a handle, then use fseek() to read through the file up to the point that is 60 * the client's ID, then just read 60 characters and obtain the client's data this way. Now, I'm curious, would this be a faster way to do it, or does seeking still take the entire file into account?