PDA

View Full Version : Writing to a file. (PHP)


Nasimov
03-15-2004, 12:57 PM
It's possible to ammend data within a file vs. just adding data to the beginning or the end of the file? Mean to change something in the "middle" of the file.
Thanks.

TomD
03-15-2004, 03:40 PM
Look at the list of PHP filesystem (http://www.php.net/filesystem) functions.

You can move a file pointer around in a file and read and write.

I think it would be easier to read the file into a buffer or array, manipulate the buffer and then write the buffer back to the file. This would also give you an abort option up till the write command.