I test this PHP code on windows and it first removes the file.txt contents and then write the new contents on it.
$f = fopen('file.txt', 'r+');
fwrite($f, "first-time");
fclose($f);
Every time I execute this code and see file.txt, it has ONE "first-time" in it.
I expect it to prepend "first-time" to the old file. like:
first-timefirst-timefirst-time
and so on.
Why r+ acts like w+ in making zero length?