$myFile = APPPATH.'/../log.txt';
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "New Stuff 1\n";
fwrite($fh, $stringData);
$stringData = "New Stuff 2\n";
fwrite($fh, $stringData);
fclose($fh);
Above shown is my code.
output :
New Stuff 1New Stuff 2
I need New Stuff 2 in the second line
Also the newly written data should append to the existing data.How to fix the issue.
You need to use PHP Predefined Constant
PHP_EOLit will produce
\r\n