PHP Write string to new line for the first time and not at the end of file
codeigniter, php
Solution
Not knowing much about this write_file() function, but given what you said, this should work :
write_file("path_to_file", "\n"."String four"."\n", "a+")
Problem
Using Codeigniter function `write_file()`, I can write to an existing file like this: ``` write_file("path_to_file", "String four"."\n", "a+"); ``` Assume I already have a file like this: ``` String one String two String three ``` With `write_file("path_to_file", "String four"."\n", "a+")` , I have the ouput below when writing to file for the first time: ``` String one String two String three String four ``` Any idea about how I can write String four to new line for the first time? Like shown below: ``` String one String two String three String four ``` Thanks.