Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/71476-what-are-file-streaming-concepts/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.