homepage Welcome to WebmasterWorld Guest from 54.234.147.84
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP Appending to line to files
blaketar




msg:3567364
 2:14 am on Feb 6, 2008 (gmt 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...

 

phparion




msg:3567412
 4:55 am on Feb 6, 2008 (gmt 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.

jatar_k




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved