Welcome to WebmasterWorld Guest from 54.162.205.151

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)

Full Member

10+ Year Member

joined:June 24, 2004
posts: 202
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 9, 2005
posts:817
votes: 0


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)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 0


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