codeigniter - PHP Write string to new line for the first time and not at the end of file -
using codeigniter function write_file()
, can write existing file this:
write_file("path_to_file", "string four"."\n", "a+");
assume have file this:
string 1 string 2 string 3
with write_file("path_to_file", "string four"."\n", "a+")
, have ouput below when writing file first time:
string 1 string 2 string 3 string 4
any idea how can write string four new line first time? shown below:
string 1 string 2 string 3 string 4
thanks.
not knowing write_file() function, given said, should work :
write_file("path_to_file", "\n"."string four"."\n", "a+")
Comments
Post a Comment