Forum Moderators: coopster

Message Too Old, No Replies

PHP Appending to line to files

         

blaketar

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

phparion

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

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



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.

jatar_k

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

WebmasterWorld Administrator 10+ Year Member



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