tcjohans Posted October 2, 2007 Share Posted October 2, 2007 Hi, I am looking for an efficient way to access and read files. The context is that I am trying to construct a flat file database and am looking for efficient ways to arrange the data in files over tables, and for reading and editing such files. In another forum, somebody wrote that "most programmers don't know how to script [flat file databases] efficiently. Instead of using file streaming concepts, too many developers take the file() and file_get_contents() noose and hang themselves with it." I wonder if someone could explain briefly what such file streaming concepts might be and perhaps indicate why they are more efficient than 'traditional' php file access functions. Thomas Quote Link to comment https://forums.phpfreaks.com/topic/71476-what-are-file-streaming-concepts/ Share on other sites More sharing options...
HuggieBear Posted October 2, 2007 Share Posted October 2, 2007 I'd imagine that the reason these comments were made is that in both of those functions, the entire file is read into either a string or an array, however by using fopen(), fread(), fget() etc, you can get each line at a time. I'd imagine that when dealing with large files this makes it a whole lot more scalable! Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/71476-what-are-file-streaming-concepts/#findComment-359968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.