PHP Code:
ofstream fout("file.txt"ios::app); //for append
fout<<"some text";
fout.close();