Jump to content

What are file streaming concepts??


tcjohans

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.