Welcome to WebmasterWorld Guest from 23.20.37.222

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Appending to line to files

     
2:14 am on Feb 6, 2008 (gmt 0)

10+ Year Member



I have a small app which appends some data to the end of a file. My question is, when PHP goes to append the data to the file, does it have to load the entire file, then append the data to the end?

I am concerned because this file continues to grow in size and so if the file must be loaded into memory first, then I shouldn’t allow the size of the file to get to large. On the other hand, if PHP simply appends to the end, then no need for concern...

4:55 am on Feb 6, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I am not 100% sure, but i think when you use fopen() it sends back you the handle to that profile without loading the file into memory. if you want to get contents of the file you use file_get_contents()...

if wrong please rectify.

12:58 pm on Feb 6, 2008 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



phparion is correct fopen creates a file handle but does not read the file contents
 

Featured Threads

Hot Threads This Week

Hot Threads This Month