Saving a file after modifying it

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jateeq
Forum Newbie
Posts: 14
Joined: Mon Mar 01, 2010 12:16 pm

Saving a file after modifying it

Post by jateeq »

Hello,

I've opened a file, made changes to it, and want to 'save' those changes. At the moment, I am opening the file in a textbox for the user to modify, and then when he/she clicks on 'save', whatever is in the textbox overwrites the original content of the file (i am opening the file with the 'w' option when i write to it). I suspect that this is inefficient, since if a user just adds one line at the end of a 1000 lined file, i'm wasting time writing useless strings to the file. Does anyone know of a way in which only the changes will be written to the original file, or is this way feasible enough?

Thank you,
Jawad.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Saving a file after modifying it

Post by requinix »

It's really not worth the effort. Stick with what you have.
Post Reply