0
Does Writing Files First Erase?
Part of the course says that: w: Opens file for write only. Erases the contents of the file or creates a new file if it doesn't exist. Does this mean that if you want to write something onto a file, you should use "a" if you want to keep what is already there? Or do you have to first read a file and then write to it what you read plus what you wanted to add?
1 Antwort
+ 4
Yes, using the flag 'a' allows you to append to the file instead of overwriting it without having to read in the content first:
https://www.sololearn.com/learn/PHP/1846/