how to append new content in a file ??for example i have a file welcome.txt and i have some content in it lets say "hello world"...........now what i want is to append some more content in this existing file such that the new content comes in a new line........ like
hello world
welcome
thanks in advance
append new content in a file from new line
Moderator: General Moderators
Re: append new content in a file from new line
Open it in "append" mode.
Code: Select all
$fh = fopen('test.txt', 'a');There are 10 types of people in this world, those who understand binary and those who don't
Re: append new content in a file from new line
i have already opened it in a append mode the content is getting appended but not from a new line.thats the main problem??
Re: append new content in a file from new line
Maybe because you have a "\n" caharacter when you write the string to the file.
Use trim() on the string before writing it.
Use trim() on the string before writing it.
There are 10 types of people in this world, those who understand binary and those who don't